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] SQLDriverConnect blocks after a while
- Date: Tue, 16 Jan 2007 14:39:09 +0100
Hi all,
I'm having a strange problem with my program. The program is using the
unixodbc driver. I'm executing quit some queries and everything seems to
work fine, but after a while, my program is suddenly blocked. After some
debugging I found that it is blocked in the SQLDriverConnect function. The
function is called dozens of times without a problem and after a while the
function doesn't return any more. I had hoped it would be solved with
setting the LOGIN_TIMOUT attribute, but that didn't help. Below you can find
a short version if the function (I removed all irrelevant information, like
checks on return values):
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);
ret = SQLSetConnectAttr( connection, SQL_ATTR_CONNECTION_TIMEOUT,
(SQLPOINTER)5, 0);
ret = SQLSetConnectAttr( connection, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)5,
0);
strcpy(ConnectionString,"DRIVER=TDS;SERVER=");
strcat(ConnectionString,IpAddress);
strcat(ConnectionString,";PORT=1433;TDS_Version=8.0
;UID=MYUID;PWD=MYPWD;DATABASE=MYDB;");
ret = SQLDriverConnect(connection, NULL, (SQLCHAR *)ConnectionString,
SQL_NTS, outConnectionString, 1024, &len, SQL_DRIVER_NOPROMPT); -> so here
it is blocked
ret = SQLAllocHandle(SQL_HANDLE_STMT, connection, &cmd);
...
// some queries
...
ret = SQLFreeHandle(SQL_HANDLE_STMT, cmd);
ret = SQLDisconnect( connection );
ret = SQLFreeHandle( SQL_HANDLE_DBC, connection );
ret = SQLFreeHandle( SQL_HANDLE_ENV, context );
Anybody an idea what could be the source of this problem?
regards,
Frederik.
- [freetds] SQLDriverConnect blocks after a while, Frederik Teerlinck, 01/16/2007
Archive powered by MHonArc 2.6.24.