Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download image data from MS SQL Server to Solaris via Merant ODBC

Status
Not open for further replies.

siqian

Programmer
Oct 16, 2001
1
US
Hi,

I am trying to download image/blob data from MS SQL Server to Solaris via Merant ODBC.
I first connected and allocated statement handle. Then called
ret = SQLExecDirect(hstmt,"select blob from MyTbl where id = 1",SQL_NTS);
(ret = SQL_SUCCESS returned).
I then do SQLFetch()
while((ret = SQLFetch(hstmt)) != SQL_NO_DATA) { ...... }

Now the problem comes: the very first call to SQLFetch() failed with the following error:
ret = SQL_ERROR
ErrState = 22003
ErrMsg: [MERANT][ODBC SQL Server Driver]Numeric value out of range

I then put a call
ret = SQLDescribeCol() between SQLExecDirect() and SQLFetch(),
this call returned all the correct info:
ColName = "blob",
ColNameBuffLen = 4,
ColType = SQL_LONGVARBINARY,
ColSize = 566 Bytes
DecimalDigits = 0,
Nullable = 1,

which means the ODBC driver had the correct knowledge of the nature of the image/blob column. So the question is why SQLFetch() failed with the message "Numeric value out of range", there are no numeric value involved at all.

Any help would be greatly appreciated.

Siqian He
he@ncbi.nlm.nih.gov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top