| title | OLE DB Driver for SQL Server Support for LocalDB |
|---|---|
| description | Learn how to connect to a lightweight version of SQL Server, called LocalDB, using OLE DB Driver for SQL Server. |
| author | David-Engel |
| ms.author | davidengel |
| ms.date | 04/20/2021 |
| ms.service | sql |
| ms.subservice | connectivity |
| ms.topic | reference |
[!INCLUDE SQL Server]
[!INCLUDEDriver_OLEDB_Download]
Beginning in [!INCLUDEssSQL11], a lightweight version of SQL Server, called LocalDB, will be available. This article discusses how to connect to a database in a LocalDB instance.
For more information about LocalDB, including how to install LocalDB and configure your LocalDB instance, see:
LocalDB allows you to:
-
Use
sqllocaldb.exe ito discover the name of the default instance. -
Use the
AttachDBFilenameconnection string keyword to specify which database file the server should attach. When usingAttachDBFilename, if you don't specify the name of the database with theDatabaseconnection string keyword, the database will be removed from the LocalDB instance when the application closes. -
Specify a LocalDB instance in your connection string:
SERVER=(localdb)\v11.0If necessary, you can create a LocalDB instance with sqllocaldb.exe. You can also use sqlcmd.exe to add and modify databases in a LocalDB instance. For example, sqlcmd -S (localdb)\v11.0.