fast local database - c#

i have a desktop application that talks soap to a server. the communication is very slow so i want to download a lot of the data up front and query from my local database. i wan this local data to persist after the application shuts down so what is the best way for doing this . . . are there any good products / examples to do this . . there are about 25 tables that i am caching.

SQLite is perfect for this. A couple years ago I wrote a "smart client" application where I maintained a local cache so that users could still use the application offline. I used SQLite and had no problems, it is very small, persists quickly, and most modern ORMs support it. (I was using NHibernate)
http://www.sqlite.org/

Berkeley DB is a good, standalone DB. You should also consider ESENT, which is built into windows. Here's a write-up by Ayende.

The H2 database might also meet your needs. Microsoft offers a compact edition of SQL Server: SQL Server Mobile Edition. If SQL Server and TSQL is your thing, this might be a good choice.

You could always use an Access DB, usually pretty simple to ingereate with in .NET app and doesn't require any server to be installed or configured on the client.

Consider using Firebird, I believe they have a ADO.NET extension too.

I would consider SQL Server Express or even SQL Server Compact Edition, which operates on individual database files, like Access does. Despite this, it's still SQL Server.

You could also consider Apache Derby, which is used in Sun's Glassfish Java EE server.

Related

.NET Embedded/Offline DB that works with EF

I've been researching different solutions for an offline database.
Basically I have a desktop application and I would like it to communicate with a database, without requiring internet connection. So I am looking for a way to ship my app along with a database that the app can work with.
All my DB intercation will happen through Entity Framework, so I need a solution that is compatible with it. So far, I have always used SQL Server Express for my DB, but as far as I know that requires that SQL Server is installed on the user's machine, which is obviously not what I need.
My DB will not need to handle huge amounts of data. (Worst-case would be something around 100,000 - 1,000,000 rows of data in the DB).
From what I am reading I found that SQLite, and SQL Server CE and a feature of SQL Server called LocalDB might do the job for me. (SQL Server CE is no longer supported my Microsoft, so I am guessing its not a good idea)
I was wondering if I am on the right track here? Is this the way to go, or is there a way to embed my SQL Server Express into my app.
SQL Server Compact and SQLite can both run as embedded and work with EF (SQL Ce much better than SQLite)
LocalDB might also be an option, requires admin access to install (not during runtime)

developing sql application using local database

I am starting an application (c#, .net) that will interact with a Microsoft SQL database. I need the ability for multiple clients to access the data concurrently so I an going to use a service based database (.mdf). Is it possible to develop the application using a local database (.sdf) and then easily switch it over to a service based database when it comes time for deployment? Is that how this type of development it typically done?
You can control the data source by providing connection string to your database in .config file.
You can even create Debug and Release versions of your .config file with different connection strings. Debug can point to your local machine and Release to production.
Development shops vary, but it is pretty common to develop apps using SQL Express locally and then use a full installation of SQL Server for the production environment.
The only thing I would advise is make sure that the DB you chose for your dev environment supports the same features as what you expect in production. For example don't use SQL Express on your dev box when you expect to use Oracle in production.
If the database schema in both backends is exactly the same than the only thing you will need to do is change the connection string when you are ready to move to the service based database.
Be aware that the slightest change in the schema can (and probably will) cause problems.
You want to use SQL Compact Edition (as you said database file extension is .sdf), right? You can use MSSQL Express Edition instead, as it acts more like full MSSQL Server, and is still free and not so hard to install on developer's machine (I personally prefer this option). There are differences between the two (as explained here: http://blog.sqlauthority.com/2009/04/22/sql-server-difference-between-sql-server-compact-edition-ce-and-sql-server-express-edition/). If you don't want features like triggers/procedures/views in your database, you can still use CE, though.
If you have multiple clients then you should use SQL Server Express (.mdf file) - SQL Server Compact (.sdf file) is useful when you are building an application that is going to be deployed on client machines and will run standalone, e.g. windows forms application with a local database. SQL Server Compact is just an alternative for MS Access .mdb files or SQLite, the so called "embedded databases", while SQL Server Express is a real database server (albeit with some limitations to render it unsuitable for large commercial applications) and should be used in the cases where multiple clients use central database, e.g. web applications and smart client apps (the latter could also make use of a local embedded database though).

using MySQL with C#

I want to know if it is possible to use MySQL Engine without having to install WAMP Server. I'm developing an application that will require a database, so I was thinking of using MySQL instead of MS SQL or access. So I don't want to install the WAMP package yet I want to install the MySQL Engine, so if possible, please provide me with the download link for the MySQL and how to install and use (start/stop service).
You will need the runtime and the .net connector to make this happen. You also might find the workbench (gui tools to manage the server and run queries) to be helpful.
The runtime installs a service by default, which you can control on the commandline or via the windows service management console (services.msc).
This sounds to me a lot like you're thinking 'desktop application', where the MySQL database will be a simple local data store. If that's the case, MySQL is not a good choice.
MySQL is a server-class database engine. It's designed to run full time in the background as a service. This makes it overkill for a simple desktop app, and as a user I'd be mad if your simple desktop app required me to run the MySQL service.
For the kind of app I think you're building, you really want an in-process or desktop-class database. Good examples include SQLite, SQL Server Compact Edition (not Express), or even MS Access. Any of those would be a better option here than MySQL.
On the other hand, if I'm wrong and you're building a web app or an app that will be distributed to several computers that all share the same database, then MySQL is a perfectly fine choice and you should read #Femaref's answer.
If your database isn't going to be incredibly large you could go with SQL Compact. It comes with the .NET framework, and works well for smaller databases.

DBMS for POS software

I want to develop a POS application in .NET (C#) that would be used to rent items. I have a good idea of what will be done and the famous question that I have is about the DBMS that I should use. I would like to use MySQL database.
The question is: If some places use only one computer (no network, no internet connection), can I use a MySQL database in local? Do I need to install MySQL server on all thoses computers to be able to use such a database? I know SQLite but I'm not sure if the limitations can cause problems in the future... I also looked at SQLServer Express versions.
(I must consider that other point of sales are using multiple computers and more transactions so there I can't put sqlexpress or sqlite)
So can anybody suggest me what I should do in that situation?
Thanks
You would be able to use MySQL in localhost - and it would need to be installed on each local machine.
You could use MySQL. If you are sharing a database between several computers you should just be able to install the MySQL client components.
As for which database you want to use, I would highly suggest SQL Express. The security model and tooling is much better. There is nothing stopping you from using SQL Express as a shared database server until you out grow it.
SQL Express Redistribution EULA
POS systems like Open bravo POS software where special user types and hardware devices support are required.ou can use sharing a database between several computers for using sql.

SQL Server Express / MS Access LINQ Features, Which One to Use?

I have a few ASP.Net database front-end websites where MS Access is the back-end. I am trying to use ASP.Net dynamic data website. Should I change this database to SQL Server Express or something else to make it easier or should this work from with MS Access.
Pick SQL Express for these reasons:
Scaling: MS Access will never scale. Once you get over about 10 concurrent connections you will start to see trouble. SQL Express will scale. You can always move SQL Express up to a full-blow SQL Server installation. While this is somewhat true of Access, some of your SQL statements and data types may not transfer cleanly.
Security: SQL Server has a much better security model than Access. You can lock down the schema in your db per user. You can also better administrate user access (think dev user vs test user vs production user).
Performance: This is similar to scaling. If you see a traffic spike to your web site, Access may not handle it while SQL Server Express probably will.
Tools: Tools and libraries like LINQ are always going to be targeted at SQL Server. You will get better support and better documentation using them this way.
A Jet back end will work fine for mostly read-only websites, even ones with decent traffic. Michael Kaplan's old website, http://trigeminal.com, uses a Jet database as the back end, and back when it was his primary site (he's since been hired by Microsoft), he said it was getting over 100K hits per day, and was holding up just fine.
For read/write operations, Jet will begin to bog down on a website about the same place it would bog down in a multi-user LAN application, at somewhere between 20 and 50 simultaneous connections, depending on your app's design.
For what it's worth, even though I'm a professional Access developer and know Jet very, very well, I don't use Jet as a back end for any of my websites. That's not so much because I don't like Jet for websites, but because I don't like Windows for a web server -- I'm an Apache supporter (and PHP developer), and host all my websites (and my clients' as well) on non-Windows hosting services (presently all of them are Linux, but that wasn't always the case). All the website databases I have ever done use MySQL for the back end.
In short, find out what your host offers in terms of database back ends and choose the best one. I can't imagine a host that provides ASP.NET that would not offer SQL Server, and that's definitely what I'd go with in that situation. It would be easy enough to upsize your Jet back end to SQL Server on your local PC, and then do a backup that you could import to your website.
You can use LINQ to DataSets to use Linq against an Access .mdb or .accdb database.
You can read more at http://msdn.microsoft.com/en-us/library/bb386977.aspx and http://blogs.msdn.com/adonet/archive/2007/01/26/querying-datasets-introduction-to-linq-to-dataset.aspx

Categories