By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,610 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,610 IT Pros & Developers. It's quick & easy.

SQLStatistics driver bug?

P: n/a
Hi,

I am trying to find the number of rows in a DB2 table using ODBC
SQLStatistics. Although, the documentation claims that this is
supported, I am getting SQL_ERROR when the data is fetched (simplified
code shown below). When I run it against SQLServer, Access, Excel it
runs fine but not against DB2 and red Brick. Can anyone tell me if
this is a driver bug or am I missing something?

// Allocate a statement handle.
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc1, &hstmt1);

// get stats
retcode = SQLStatistics(hstmt1, NULL, 0, NULL, 0, "xyz", SQL_NTS,
SQL_INDEX_UNIQUE, SQL_QUICK /* SQL_ENSURE */); // tried both ENSURE
and QUICK

// Bind columns
SQLBindCol(hstmt1, 7, SQL_C_SSHORT, &DataType, 0, &cbDataType);
SQLBindCol(hstmt1, 11, SQL_C_SLONG, &Cardinality, 0,&cbCardinality);

// fetch results in a loop
retcode = SQLFetch(hstmt1);

FOR DB2: [IBM][CLI Driver] CLI0110E Invalid output or indicator
buffer specified. SQLSTATE=22002

FOR RedBrick: [Red Brick][ODBC Driver]** ERROR ** (10002) NULL value
in column 11, but no indicator.

TIA,
Niles
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.