Search code examples
c#sql-serverlocaldb

Understand localDB is relation to SQL Server Express and SQL Server CE


I'm trying to understanding LocalDB by reading MSDN: SQL Server 2016 Express LocalDB and MSDN: SQL Server Express LocalDB and SQL Server Express and a number of SO posts including confusion about SQL Server Express and localdb, I still cannot understand what is LocalDB. I understand and have used SQL Server Express and SQL Server CE.

Questions:

LocalDB...the necessary SQL Server infrastructure is automatically created and started

My understanding is that, if using LocalDB to handle an application's database, neither the developer nor the client machine where the application is deployed needs to install the heavy SQL Server Express, but just need to install the lighter LocalDB. How, then, without SQL Server Express install can localDB "create(d) and start(ed)" SQL Server? If localDB

... once installed, LocalDB is an instance of SQL Server Express that can create and open SQL Server databases. The system database files for the database are stored in the users' local AppData path which is normally hidden.

If developer or client can use localDB without installing SQL Server, how can localDB be an instance of something that is not installed? Or is localDB an incomplete version of SQL Server Express that just does not need to click..click..click.. to configure. Essentially localDB works like SQL Server CE where localDB use some hidden "files" in AppData to create database while SQL Server CE use the dll to generate the database?

SqlLocalDB.msi program to install the necessary files on the computer

If client still needs to install localDB (which is not really portable along with the application like SQL Server CE), then why not just install SQL Server Express? Either localDB or SQL Server Express is above 100MB+ anyway and need separate installation, what is the point of using localDB anyway?


Solution

  • LocalDB is a programmer-oriented version of SQL Server Express that needs to be installed just like SQL Server Express.

    Unlike SQL Server Express, it's not installed as a Windows Service that starts up with your Windows OS - but it only starts up as needed (when your application starts up, or when you start it manually with the SqlLocalDb command line tool).

    But LocalDB IS SQL Server Express (not Compact Edition). It uses the same .mdf and .ldf database files like and desktop/server version of SQL Server, not SQL Server CE's .sdf file format.