SQL Server Native Client Support for LocalDB

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)

Important

The SQL Server Native Client (often abbreviated SNAC) has been removed from SQL Server 2022 (16.x) and SQL Server Management Studio 19 (SSMS). The SQL Server Native Client (SQLNCLI or SQLNCLI11) and the legacy Microsoft OLE DB Provider for SQL Server (SQLOLEDB) are not recommended for new application development. Switch to the new Microsoft OLE DB Driver (MSOLEDBSQL) for SQL Server or the latest Microsoft ODBC Driver for SQL Server going forward. For SQLNCLI that ships as a component of SQL Server Database Engine (versions 2012 through 2019), see this Support Lifecycle exception.

Beginning in SQL Server 2012 (11.x), a lightweight version of SQL Server, called LocalDB, will be available. This topic discusses how to connect to a database in a LocalDB instance.

Remarks

For more information about LocalDB, including how to install LocalDB and configure your LocalDB instance, see:

To summarize, LocalDB allows you to:

  • Use sqllocaldb.exe i to discover the name of the default instance.

  • Use the AttachDBFilename connection string keyword to specify which database file the server should attach. When using AttachDBFilename, if you do not specify the name of the database with the Database connection 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.0  

If 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.

See Also

SQL Server Native Client Features