Skip to Content.
Sympa Menu

freetds - [freetds] SQLGetTypeInfo() fails when it is called for the second time (10/08/2008 Dmitry Basko)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: marko68 GMX <marko68 AT gmx.net>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] SQLGetTypeInfo() fails when it is called for the second time (10/08/2008 Dmitry Basko)
  • Date: Wed, 8 Oct 2008 14:00:51 -0700

Hi,

Yesterday I tried freetds (v0.82) on Mac OS 10.5 (Intel) and now have
a question in this regard. I would appreciate it very much is someone
could give me an advice, as I seem to run out of ideas what can be
wrong. The following piece of the code does not work if it is called
sequentially:

find_an_appropriate_data_type(...)
{
SQLBindCol(hToStmt, 1, SQL_C_CHAR, szTypeName ...);
SQLBindCol(hToStmt, 3, SQL_C_LONG, &cbMaxPrec,...);
...
SQLGetTypeInfo(hstmt, fSqlType) (where fSqlType is 5 (small integer))
SQLFetch(hstmt);
...
SQLFreeStmt(hstmt, SQL_CLOSE);

if !(does_the_found_MS_SQL_data_type_suit_us)
try another one;
}
The main idea behind this cycle is an attempt to figure out the right
correspondence between available (supported by the application) data
types and the ones supported by MS SQL. The first call of the
function returns the requested type info, but the second call
fails: SQLGetTypeInfo returns -1. The call of SQLGetDiagRec
returns the following error:

08S01 - [FreeTDS][SQL Server]Communication link failure

Alas, the ODBC tracing long does not contain any useful information:
--

A02D7FA0 ENTER SQLBindCol
SQLHSTMT 0x208e70
SQLUSMALLINT 1
SQLSMALLINT 1 (SQL_C_CHAR)
SQLPOINTER 0xbffee008
SQLLEN 32
SQLLEN * 0xbffee004

A02D7FA0 EXIT SQLBindCol with return code 0 (SQL_SUCCESS)
SQLHSTMT 0x208e70
SQLUSMALLINT 1
SQLSMALLINT 1 (SQL_C_CHAR)
SQLPOINTER 0xbffee008
SQLLEN 32
SQLLEN * 0xbffee004 (2132496)

A02D7FA0 ENTER SQLGetTypeInfo
SQLHSTMT 0x208e70
SQLSMALLINT 5 (SQL_SMALLINT)

A02D7FA0 EXIT SQLGetTypeInfo with return code 0 (SQL_SUCCESS)
SQLHSTMT 0x208e70
SQLSMALLINT 5 (SQL_SMALLINT)

A02D7FA0 ENTER SQLFetch
SQLHSTMT 0x208e70

A02D7FA0 EXIT SQLFetch with return code 0 (SQL_SUCCESS)
SQLHSTMT 0x208e70

A02D7FA0 ENTER SQLFreeStmt
SQLHSTMT 0x208e70
SQLUSMALLINT 0 (SQL_CLOSE)

A02D7FA0 EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS)
SQLHSTMT 0x208e70
SQLUSMALLINT 0 (SQL_CLOSE)

A02D7FA0 ENTER SQLGetTypeInfo
SQLHSTMT 0x208e70
SQLSMALLINT 5 (SQL_SMALLINT)

A02D7FA0 EXIT SQLGetTypeInfo with return code -1 (SQL_ERROR)
SQLHSTMT 0x208e70
SQLSMALLINT 5 (SQL_SMALLINT)

A02D7FA0 EXIT SQLGetDiagRec with return code 0 (SQL_SUCCESS)
SQLSMALLINT 3 (SQL_HANDLE_STMT)
SQLHSTMT 0x208e70
SQLSMALLINT 1
SQLCHAR * 0xbffeddf2
| 08S01 |
SQLINTEGER * 0xbffedd80 (0)
SQLCHAR * 0xbffedb7a
| [FreeTDS][SQL Server]Communication link |
| failure |
SQLSMALLINT 512
SQLSMALLINT * 0x0


It looks like the connection is broken but why?

--
Thanks,
Marko





Archive powered by MHonArc 2.6.24.

Top of Page