I'm trying to use
odbcDriverConnect('driver={SQL Server};server=servername\instancename,port;database=testing;username=abc;password=123456')
to connect remote database server (sql server 2008). But I got
[RODBC] ERROR: state 08001, code 17, message [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
error. Any idea?
I can use
odbcDriverConnect('driver={SQL Server};server=localhost;database=testing;trusted_connection=true')
to connect my local database server (sql server 2008).
The correct syntax should be:
odbcDriverConnect('driver={SQL Server};server=servername\\instancename,port;database=testing;uid=abc;pwd=123456')
If you use Windows Authentication method:
odbcDriverConnect('driver={SQL Server};server=servername\\\\instancename,port;database=testing;trusted_connection=true')
Slash seems like an escape character, escaping slash works.