[freetds] Unable to connect to data source

Igor Korot ikorot at earthlink.net
Thu Sep 28 04:12:07 EDT 2006

Did you try to search MSDN? This is ODBC problem as a very least...
>From MSDN:

If the DriverCompletion parameter value is SQL_DRIVER_NOPROMPT or SQL_DRIVER_COMPLETE_REQUIRED and the language or database comes from the connection string and either is invalid, SQLDriverConnect returns SQL_ERROR.


Thank you.

-----Original Message-----
>From: Frederik Teerlinck <largowww at gmail.com>
>Sent: Sep 28, 2006 12:17 AM
>To: freetds at lists.ibiblio.org
>Subject: [freetds] Unable to connect to data source
>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,
>ret = SQLAllocHandle(SQL_HANDLE_DBC, context, &connection);
>-> this all returns ok
>ret = SQLDriverConnect(connection, NULL, (SQLCHAR *)
>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
>are working as perfect, so I think my configuration of freetds and the odbc
>driver should be ok.
>This is my configuration:
>Driver          = TDS
>Description     = ODBC connection via FreeTDS
>Trace           = No
>Servername      = MYDBNAME
>Description             = FreeTDS
>Driver          = /usr/lib/odbc/libtdsodbc.so
>Setup           = /usr/lib/odbc/libtdsS.so
>FileUsage               = 1
>In freetds.conf I have:
>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 mailing list
>FreeTDS at lists.ibiblio.org

More information about the FreeTDS mailing list