Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to LocalDB with new ODBC Driver for SQL Server

UPDATE: Thanks to Dan Guzman, the problem has been solved. I'd made a mistake and used the old legacy Driver={SQL Server}; assuming it is the new driver. Instead, I should have used Driver={ODBC Driver 11 for SQL Server} which is the actual new ODBC driver. I can connect to (Localdb)\v11.0 with the new driver.


TL;TR: Why I can not connect to (Localdb)\v11.0 using the new Driver={SQL Server}; in connection string, but I can connet if I switch the driver to the old Driver={SQL Server Native Client 11.0}; ?

The remaining connection string parameters I use are (if used in C++ code, backslash escaped):

Server=(localdb)\v11.0;Integrated Security=True;

I'm trying to access SQL Server via ODBC and calling SQLDriverConnect with DSN-less connection string. If I switch the driver to SQL Server Native Client 11.0, then I suddenly can connect.

I have also tested generating FILEDSN using %systemdrive%\Windows\System32\odbcad32.exe and I observed exactly the same issue.

The only local database I can connect with the new Driver={SQL Server} is Server=DEVBOX\SQLEXPRESS (if used in C++ code, backslash escaped, of course).

I couldn't find any confirmation that the new ODBC Driver for SQL Server does not support LocalDB.

It is only indicated in the FAQ of ODBC Driver for SQL Server for Linux

Which features of SQL Server 2012 does this version of the driver support? The ODBC driver on Linux supports all server features in SQL Server 2012 except LocalDB.

How can I connect to LocalDB with the new ODBC driver on Windows?

UPDATE: I'm using Windows 10 Pro + VS2015. I can connect to both, (localdb)\v11.0 and DEVBOX\SQLEXPRESS with SQL Server Management Studio 2016 (CTP). (The same question has been asked on MSDN Forums, here.)

like image 748
mloskot Avatar asked Nov 27 '15 14:11

mloskot


People also ask

How do I connect to ODBC driver 17 in SQL Server?

Using a non-standard port Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword; The default SQL Server port is 1433 and there is no need to specify that in the connection string.


1 Answers

The ODBC driver SQL Server is the legacy SQL Server ODBC driver that ships with Windows for backwards compatibility. The latest SQL Server ODBC driver is ODBC Driver 11 for SQL Server. I believe this ODBC driver is installed with SQL Server 2016 CTP. The released version is available as a separate download.

like image 87
Dan Guzman Avatar answered Oct 05 '22 15:10

Dan Guzman