Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: How to insert BLOB into DB2 using DBI?

by Tanktalus (Canon)
on Jan 14, 2005 at 15:40 UTC ( [id://422275]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to insert BLOB into DB2 using DBI?
in thread How to insert BLOB into DB2 using DBI?

When you SELECT that column, you should have the raw data in the returned row - just write it to the new file ... print FH $data should work.

(So far, I doubt any of this is DB2 specific ;->)

Replies are listed 'Best First'.
Re^4: How to insert BLOB into DB2 using DBI?
by rdfield (Priest) on Jan 14, 2005 at 15:46 UTC
    Not quite, you need to set the value for LongReadLen otherwise you might not get all of the data back.

    rdfield

Re^4: How to insert BLOB into DB2 using DBI?
by Anonymous Monk on Jan 14, 2005 at 15:47 UTC
    Actually, it's not working. My code is:
    open(INFILE,"X:\\\\ongoing\\bioinformatics\\db2\\image\\picture1.wmf") +; binmode(INFILE); $img_data = <INFILE>; close(INFILE); my $stmt = "INSERT INTO project_figures (pjfg_id, pjfg_name, pjfg_imag +e) VALUES(?,?,?)"; my $sth = $dbh->prepare($stmt); my $rc = $sth->execute(1,'picture1.wmf', $img_data);
    And I get
    DBD::ODBC::st execute failed: [IBM][CLI Driver] CLI0110E Invalid outp +ut or indicator buffer specified. SQLSTATE=22002 (SQL-22002)(DBD: st_ +execute/SQLExecute err=-1) at insert_image.pl line 24. DBD::ODBC::st execute failed: [IBM][CLI Driver] CLI0110E Invalid outp +ut or indicator buffer specified. SQLSTATE=22002 (SQL-22002)(DBD: st_ +execute/SQLExecute err=-1) at insert_image.pl line 24.

      I'm trying to get this working myself - although I'm using DBD::DB2 rather than DBD::ODBC. I'll try to update this when I figure out what I'm doing wrong ;-)

      First - I suggest using DBD::DB2 if you can (I realise that on Windows it's easier said than done ... which is why I like my Linux box ;->). Second - can you tell me which version of DB2, and which product you're using on Windows? And, if the server is a different machine, what it is (version, product, OS)? e.g., "DB2 Runtime Client v7.2 running against DB2 ESE v8.1FP6a on AIX" - Thanks

      UPDATE: The dtlob.pl script that is part of DB2 v8.2's samples (be sure to install the sample applications) seems to work, although I'm still trying to figure out why when I write it myself it doesn't :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://422275]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-25 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found