freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Frederik Teerlinck" <largowww AT gmail.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] Unable to connect to data source
- Date: Thu, 28 Sep 2006 09:17:41 +0200
Well I thought my connection problem was solved, but it isn't. I still want
to connect from my C++ program on linux to an SQL server database.
Here's a part of my code:
ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &context);
ret = SQLSetEnvAttr (context, SQL_ATTR_ODBC_VERSION, (void*) SQL_OV_ODBC3,
0);
ret = SQLAllocHandle(SQL_HANDLE_DBC, context, &connection);
-> this all returns ok
ret = SQLDriverConnect(connection, NULL, (SQLCHAR *)
"DSN=MYDBNAME;UID=MYUID;PWD=MYPWD", SQL_NTS,
outConnectionString, 1024, &len, SQL_DRIVER_NOPROMPT);
-> This returns SQL_ERROR. If I get more information with SQLGetDiagRec,
this gives me:
[FreeTDS][SQL Server]Unable to connect to data source
Both:
isql MYDBNAME MYUID MYPWD
tsql -S MYDBNAME -U MYUID -P MYPWD
are working as perfect, so I think my configuration of freetds and the odbc
driver should be ok.
This is my configuration:
::::::::::::::
odbc.ini
::::::::::::::
[MYDBNAME]
Driver = TDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = MYDBNAME
::::::::::::::
odbcinst.ini
::::::::::::::
[TDS]
Description = FreeTDS
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
FileUsage = 1
In freetds.conf I have:
[MYDBNAME]
host = my.server.ip.address
port = 11433
tds version = 8.0
I've tried to change the parameters in SQLDriverConnect (adding the port,
driver, database, ...), but I always get the same result.
Anybody an idea why I can't make a connection?
-
[freetds] Unable to connect to data source,
Frederik Teerlinck, 09/28/2006
- <Possible follow-up(s)>
-
Re: [freetds] Unable to connect to data source,
Igor Korot, 09/28/2006
- Re: [freetds] Unable to connect to data source, Frederik Teerlinck, 09/28/2006
Archive powered by MHonArc 2.6.24.