htrobert has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm trying to upload an image file to DB2 via DBI. I'm getting an error message about an "invalid output or indicator buffer", on the last line below. What am I doing wrong??
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);

Replies are listed 'Best First'.
Re: Invalid buffer?
by ghettofinger (Monk) on Jan 14, 2005 at 17:40 UTC
    I found the following on google.

    CLI0110E Invalid output or indicator buffer specified.

    Explanation: The returned data was NULL but the output or indicator buffer specified was a NULL buffer.
    User Response: Respecify the output or indicator buffer supplying a non-NULL buffer and retry the operation.

    Regards,
    ghettofinger

Re: Invalid buffer?
by dragonchild (Archbishop) on Jan 14, 2005 at 16:08 UTC
    You sure you opened your file correctly?

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      Yes, it clearly read binary data into the variable.
        Try:
        use DBI qw( :sql_types ); # Lots of code here ... my $stmt = "INSERT INTO project_figures (pjfg_id, pjfg_name, pjfg_imag +e) VALUES(:1,:2,:3)"; my $sth = $dbh->prepare($stmt); $sth->bind_param( 1, 1 ); $sth->bind_param( 2, 'picture1.wmf' ); $sth->bind_param( 3, 'picture1.wmf', { db2_file => 1 ) ); my $rc = $sth->execute();

        Information found at DBD::DB2 link

        Note: I've never used DB2, so I am merely going off the documentation.

        Being right, does not endow the right to be rude; politeness costs nothing.
        Being unknowing, is not the same as being stupid.
        Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
        Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.