Saturday, March 31, 2012

Developer targeted LocalDB installs with SQL Server Express 2012

LocalDB was first introduced in 'Denali' and it continues be simple compared to SQL Express and at the same time compatible with other editions of SQL Servers regarding APIs.
Please refer to following previous posts on how it could be used with VS2010:

So where does LocalDB position itself among the various SQL Server editions?

Well, it certainly does not have everything that the higher versions of SQL Servers have but it is an embeddable, small foot print database that you just spawn from your application and connect to a database file (type MDF which has an associated LDF) to work, without needing to go through a higher version of SQL Server. Of course you will only be developing what the LocalDB can provide. You will notice that SQL Server Compact server could also be connected to file based data (type SDF) but the LocalDB has full API capabilities of higher versions of SQL Server. With the Compact version you could only do a few things, certainly much less than what you can do with LocalDB. It has a larger foot print than SQL Server Compact but more powerful. Another difference is that LocalDB is a separate process while SQL Server compact is an in-proc DLL.

Get your full dose of SQL Server compact from the following links:

These are some of the features that you may want to note while using LocalDB:

  • LocalDB is very easy to use and you can have as many applications as you like and have an instance of LocalDB with them. However you will be using the same sqlsrvr.exe to connect to a database file.
  • LocalDB can be started from SQLSrvr.exe in its installation folder but if the LocalDB has not started the application can start it if the application uses LocalDB. If the LocalDB is up, the application just connects to it. The connection is terminated when the application exits.
  • The instance of LocalDB has no database services; it stays as long as the application is on and goes out when the application exits. You will be connecting the LocalDB to a database in the application with a very easy connection path.
  • LocalDB can use the same APIs as SQL Server Express so that you can connect using the same client-side providers such as ADO.NET, ODBC, etc.
  • If the computer has multiple users each user can have his own LocalDB as described in the following post:
In fact LocalDB can be installed and used by itself although it has no management capabilities. Follow this link to LocalDB Installer:
You need to specify the version you want as shown here:

You can install it from command line as the next snippet shows:


License is important. Note that LocalDB(x32) will not install on (x64) bit machines. Refer to Window Installer blogs to see the reason why.

An installation of SQL Server Express 2012 also installs a LocalDB as shown here for the (x64) version of SQL Server Express 2012 installed on a (x64) bit Windows 7 Home Premium running on a Toshiba Satellite 775 laptop with Intel core i7-2670QM @2.20GHZ and 8.00 GB memory.

Please refer to my books on SQL Servers which deal with all aspects of connecting to SQL Servers, SQL Server Compact and many other database products. You will also learn about SQL Server management, security; many aspects of Business Intelligence and creating applications that leverage SQL Servers:

The SQL Server Express 2012 did install LocalDB but when I tried to run it from SqlSrvr.exe I was faced with this problem (see next figure). May be I need to reinstall or repair the SQL Server Express 2012. More of it in a future post. However connecting to SQL Express from Management Studio presented no problem. Right now I have only SQL Server Express 2012 but when I install Visual Studio 2011 Beta I will try creating an application that requires a LocalDB.

What was your experience?

No comments: Protection Status