views:

1137

answers:

13

I need a lightweight database engine for a desktop application. The application is not data centric, although it needs some persistent data. Which one would you use MS SQL Server express edition or SQLite?

EDIT

Is SQL Server Compact edition free? If it is the case, what about SQLite vs SQL Server Compact edition to develop this kind of application?

+2  A: 

SQLite, especially if it's single-user. One data file and one DLL.

Randolph Potter
+7  A: 

Definitely NOT Sql Server Express. That's a server class engine. You want an in-process engine. In that regard, SQLite is fine. So is Sql Server Compact Edition. Either should be adequate for your needs.

Joel Coehoorn
Sql Server compact is pretty easy to get deployed when you use clickonce, too.
Will
Although I do agree it is not particularly lightweight, there are a number of desktop apps that do use it. e.g. Act!, Microsoft Accounting.
Darrel Miller
+1 for SQLite ! As a bonus, there is a top-notch open-source ADO.NET provider available http://sqlite.phxsoftware.com/, with Entity Framework support
Thomas Levesque
I have use SqlCe with great results.
AMissico
+1  A: 

Defo SQL lite, although it has some restrictions/features that you should be aware of

Rippo
+2  A: 

If its a single user system you want to look at MS SQL Server compact edition not Express (see here: http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx )

Compact Edition is an embedable database similar to SQLite.

Unfortunately I can't make a recommendation either way.

Murph
SqlCe is very easy to deploy.
AMissico
+2  A: 

What about MS SQL Server Compact?

Tadas
+7  A: 

If you're working with C# and Visual Studio simply right-click on your project and select "Add Item..." and in the dialog select the "Local database", this will create a SQL CE (Compact Edition) database. It's got most of the functionality of SQL Express/Server as far as tables, data types, views but doesn't allow stored procs. It also works with Linq-to-SQL so it's a snap to integrate.

Timothy Walters
This is specific to VS2k8
AMissico
No, it works in Visual Studio 2010 too :P
Timothy Walters
+2  A: 

Go with SQL Server Compact - you get to use LINQ that way, which itself is worth the effort.

While SQLite is an option, you'll need to get an ORM layer, and the performance gain will be minimal / non-existent compared to SQL Server.

Sudhir Jonathan
SqlCe is very good. I have done some amazing stuff with that little database.
AMissico
+2  A: 

Some love for one of the up and comers in the .NET embedded db world -- VistaDb. The license is a bit more restrictive than Sql Server Compact (free to single developers only), but its a 100% managed DB with xcopy deployment and has VS tool integration.

Will
But that's not free software, is it?
yeyeyerman
Depends.
Will
He never said it HAD to be free... And VistaDB is a great option to let you run on the desktop, then scale up to SQL Server with the same code. It has T-SQL Procs and other things that SQL CE is missing.
Jason Short
A: 

if your need is data centric, what you really need is a file, if you need transaction (ACID) then your need is (rdbms) database.

Otherwise you'll have issues when up scaling.

call me Steve
A: 

If it's not a lot of data, and you don't need to run complicated queries (although LINQ can), why not use an XML Dataset? That way it's platform independent (could run on Linux with Mono) and doesn't require the user to install extra resource hogging software.

I use XML Datasets extensively for applications that require persistent data storage of small amounts of information. If it's only a few variables, you can also use a settings file, and it will be stored either per application or per user depending on your choices.

Silic0re
Thanks for the point. But, even thouhg the application is not data centric, the information it must persist constains also some logging of the activities. This is more convenient to be done with a database.
yeyeyerman
+1  A: 

Be aware that if you use SQL CE along with EF, you will have to generate your own id key, because SQL CE does not support multiple query.

i.e: insert -> select key for the entity -> not good

generate and id key (GUID or something else) add it to your entity and then insert -> good

MatRichard
Could you explain this issue a bit longer?
yeyeyerman
First of all sorry for the englih.What I mean by this, is that if you are using SQL server (not CE) with EF and you were to insert a new entity, 2 "operations" would happen:1- insert of your entity2- the id (if it is auto-increment of course) would be assigned to your entity.With SQL CE this is not possible the assignation of the ID will cause an Erroe therefore you will have to generate a GUID before inserting
MatRichard
A: 

Think about overhead for your end users ... SQL Server Express still takes up resources, takes time to start up on a reboot and so on. For a small amount of single-user persistent data I would go with SQLite. Unless you're doing serious binding and so on you won't need an ORM between you and it.

Alan B
+4  A: 

Firebird is a well known database and support the latest Microsoft framework

Hugues Van Landeghem