I’m trying to connect to SQL Server 2008 R2 from a C++ application as per my previous question: C++ ODBC SQL Server 2008 Connection
My DSN in C++ is
SQLDriverConnectW(dbc, NULL, L"DRIVER={SQL Server};SERVER=(local)\DB1;DATABASE=master;UID=sa;PWD=password;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
So my DSN is actually
DRIVER={SQL Server};SERVER=(local)\DB1;DATABASE=master;UID=sa;PWD=password;
This just does not work. I can connect to servers that haven’t used named instances, but on my home machine I have separate instances I need to connect to.
What would be the correct DSN to use with this to connect to a SQL Sever 2008 R2 Named Instance on my local machine?
ODBC DSN for a named pipe needs to be like this
With the addition on
np:to specific that this is a named pipe rather than atcp:connection.