Select BLOB problem using ODBC in IBM Informix client SDK 2.81
Posted in 2005
Topics: Storage & Space Management, Connectivity: ODBC / JDBC / .NET, Server Administration, Security, Permissions & Auditing, Platform-Specific Issues
Hi
I can't select BLOB field from an Informix database using VBScript in
an ASP-page. We used to have the merant ODBC-driver, but after
switching to the ODBC driver in IBM Informix client SDK 2.81 our code
does not work anymore. The database is Informix 9.3 on HP-UX.
Testexample:
--Create a test-table using dbaccess:
create table blobtst(id integer, img blob)
--insert an test image using dbaccess:
INSERT INTO blobtst (id, img)
VALUES (1, FILETOBLOB('spaceshuttle.jpg', 'client'))
--verify that the image is in the database using dbaccess:
select LOTOFILE(img, 'spaceout.jpg' , 'client') from blobtst where
id=1
So far so good. Everything works perfectly well.
Example ASP code run on IIS 9.6 showing the images in a web browser:
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.open **DSN**, ***USERNAME***, ***PASSWORD****
Set oRs = oConn.Execute("select img from blobtst where id = 1")
PicSize = oRs("img").ActualSize
Pic = oRs("img").GetChunk(PicSize)
Response.Buffer = TRUE
Response.AddHeader "Content-type", "image/jpeg"
Response.BinaryWrite Pic
Response.End
oConn.close
This is the error message we recive:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
select_blob_tst.asp, line 5
The value of PicSize is 72, but the image I used in test was 62581
bytes
Any ideas???
// Mattias Malmgren
(remove spaces)
Mattias _ at _ freefarm _ se @ yahoo . com