[freetds] Unable to connect to data source
largowww at gmail.com
Thu Sep 28 07:33:46 EDT 2006
I've been looking in that, but that didn't help me. However, it's been
solved although I don't really understand why. If I change in the code below
DSN=MYDBNAME with SERVERNAME=MYDBNAME, then it works. Strange, but ok, at
least it works now.
2006/9/28, Igor Korot <ikorot at earthlink.net>:
> 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
> >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*)
> >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
> >isql MYDBNAME MYUID MYPWD
> >tsql -S MYDBNAME -U MYUID -P MYPWD
> >are working as perfect, so I think my configuration of freetds and the
> >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
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
More information about the FreeTDS