What is the difference between SQL CE and SQLite? In what situation would i choose one over the other?
They are two competing database engines.
SQL Server Compact is from Microsoft, and is a stripped-down version of SQL Server.
SQLite is an open-source, in-process database engine.
Comparison here - seems SQLite is smaller, faster and cross platform but SQL CE is easier to integrate into .Net using the visual studio design tools
SQLite is wonderful. The entire database engine is encapsulated into a single DLL, has great SQL support, and is super fast. There are a few .NET wrappers but the best one is here.
http://sqlite.phxsoftware.com/
This provides very good .NET integration including the ability to very easily write custom functions (both scalar and aggregate) within .NET. Also since SQLite runs in-process you can call out to your .NET application directly from a query--not recommended for most situations, but occasionally is very helpful.
Also since SQLite is a single dll distributed with your application, you update it as you would your own application and never have to worry about a user having a different version installed or missing an update.
It also requires zero maintenance. You can optionally run a VACUUM
once in a while depending on your usage pattern, but you can also turn on AUTOVACUUM
.
Additionally since the database files are stored as just one file, it's very easy to copy databases and read in their data for debugging/testing.
As said above SQLite is wonderful!
Its fast lightwieght and ultra reliable.
There are a couple of constraints. It does not scale to mega-size as the whole database is contained in a single file and you are restricted to the largest file/filesystem your OS will support, even so this is good for a at least a terabyte on most OSes. The other constaint is locking; sqlite knows only one locking mode which is to lock the entire database, its OK for a multiuser system where most people are only reading the database but as soon as you get several users trying to update the DB at one time you will hit deadlocks and timeouts. These restrictions stem from SQLites roots as a database to be implemented on small embedded systems and no other database I know of scales down so well.