SQL Server localdb is an edition of SQL Server Express without server installation. Application developers can use it to distribute a database with their applications without requiring the user to install a SQL Server engine
SQL Server Express LocalDB, introduced in SQL Server 2012, is a light-weight version of SQL Server Express that replaces User Instances, which were introduced in SQL Server 2005. LocalDB (as it is commonly referred to) instances are created per each user, and the instance and their databases are installed into a user's local profile directory. By default these instance are private, but they can be shared with other users on the same server.
LocalDB runs as a background process for each user that starts their own private instance rather than as a service that is shared by all users and would have its own security context. Connectivity is only through Named Pipes; external connectivity is not available. However, specifying the correct named pipe to connect to can be problematic due to the instance name changing each time it starts (i.e. instance name = LOCALDB#{8_character_alphanumeric_id}, named pipe = np:\.\pipe\LOCALDB#{8_character_alphanumeric_id}\tsql\query).
Fortunately, a new special syntax for the Server Name was added to use in connection strings. You can specify (localdb)\InstanceName in SSMS, SQLCMD, and via the SqlConnection
class in .NET applications (though be aware that this was not available until .NET Framework version 4.0.2). This syntax provides two benefits:
- It allows for using a consistent server name in your code
- It will automatically start the LocalDB instance if it is not already running.
LocalDB can be started, stopped, and otherwise managed via the SQLLocalDB.exe
utility. Additionally, LocalDB will be automatically started when using the (LocalDB)\InstanceName connection string syntax, and it will automatically stop about 5 minutes after the last connection closes.
For more info, please see: