I'm using C++ and I can't get SQLDriverConnect to work with this
Provider=SQLOLEDB.1;Persist Security Info=True;Initial
Catalog=TheDatabase;Data Source=127.0.0.1;Use Procedure for
Prepare=1;Auto Translate=True;Packet Size=4096;Workstation
ID=WIN2K;Use Encryption for Data=False;Tag with column collation when
The error is 'Data source name not found and no default driver
However, this string does work:
Neither works with SQLConnect; the error is 'Invalid string or buffer
length'. SQLConnect only seems to like DSN Names, but not connection
This is the code snipet:
strcpy((char *)buf, "theUsername");
strcpy((char *)buf2, "mypass");
if (SQL_SUCCEEDED(iDBRC)) iDBRC = SQLDriverConnect( hDBConn, NULL,
(unsigned char *)lpszConnectionString, SQL_NTS, buf, 2048, &len,
//if (SQL_SUCCEEDED(iDBRC)) iDBRC = SQLConnect(hDBConn, (unsigned char
*)lpszConnectionString, SQL_NTS, buf, SQL_NTS, buf2, SQL_NTS);
Anyone have a clue how to make a connection to SQL Server using that
first connection string?
Changing connection strings isn't really an option. Obviously, I
could parse the first string and create one in the form of the second,
but I would rather not. I'm thinking there must be a better way.
I should probably also mention the first string does work when used
with an ADODB.Connection object.