Wednesday, April 4, 2012

LocalDB

LocalDB is light weight Express where it will perform as a local database to the application. It requires zero configurations and it comes with MSI installer.

You can download a LocalDB as SQLLocalDB.msi. Both 32 bit and 64 bit versions have the same file name. When you are installing LocalDB manually, wizard of three dialog boxes will be shown and you can easily install. If you want to install LocalDB from an application then obviously you need to install this in a quite mode.

msiexec /i SqlLocalDB.msi /qn IACCEPTSQLLOCALDBLICENSETERMS=YES

You might see a new parameter here which is IACCEPTSQLLOCALDBLICENSETERMS=YES. This will let the installer know that you accept the End User License Agreement (EULA). Without this option LocalDB installation will fail. By default, LocalDB will be installed into C:\Program Files\Microsoft SQL Server\110\LocalDB\Binn

Another important thing is with this you don’t need any SQL Server services to run which will reduce unnecessary load to the small scale applications. LocalDB processes are started automatically when it needs to connect to the database and stopped automatically. So the connection string to the LocalDB is,

"Data Source=(localdb)\v11.0;Integrated Security=true;AttachDbFileName=C:\ProjectData\myDatabase.mdf".

Important thing is to note is that LocalDB is not a replacement for the Express.

No comments:

Post a Comment