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

I'm trying to make a web application that allows the user to upload files to are oracle database. THe webserver uses the DBI::Proxy. Currently I get this error.

DBD::Proxy::st execute failed: Server returned error: Failed to execute method CallMethod: DBD::Oracle::st execute failed: ORA-01461: can bind a LONG value only for insert into a LONG column

my $dsn = "DBI:Proxy:hostname=$pghost;port=12400;dsn=DBI:Oracle:$pgdat +abase; use vars qw($conn); $conn = DBI->connect($dsn, $pguser, $pgpassword, LongReadLen=>15000000 +, AutoCommit=> 1, RaiseError=>1, PrintError=>1}); my $sql1=qq{ insert into LOCAL_FILE_BLOBS VALUES('$CWMS','$FILE_T',20,'$DES', '$org',TO_DATE('$DATE_IN','YYYY-MM-DD HH24:MI:SS'), ?,(select MAX(FILE_ID) +1 from LOCAL_FILE_BLOBS))}; print "$sql1<BR>\n"; my $sth1 = $conn->prepare($sql1);
#Thinking the line below is not being passed correctly?
$sth1->bind_param(1, $temp, {ora_field => 'FILE_DATA', ora_type =>113 }); $sth1->execute($temp);
This code is modeled after my working massinsert program I run with DBD::Oracle? Just wondering what do I have to do to make it work though DBI::Proxy? Or if it is even possible?

Replies are listed 'Best First'.
Re: INSERT BLOB data though DBI:Proxy
by tmaly (Monk) on Sep 05, 2008 at 15:18 UTC

    I am not sure for inserts, but for selects I had to set some parameters on Oracle so that it would not truncate data I retrieved from blobs

    given a connection called $dbh

    $dbh->{LongTruncOk} = 1; $dbh->{LongReadLen} = 2**14 - 8;

    Then I would do my select after these calls

      I tried your code tmaly didn't help or cause any problems I think. The problem is does DBI::Proxy support the passing of oracle types? I just added the two lines after the conn statment.
      $conn = DBI->connect($dsn, $pguser, $pgpassword,{LongReadLen=>15000000 +,AutoCommi t=>1,RaiseError=>1,PrintError=>1}); $conn->{LongTruncOk} = 1; $conn->{LongReadLen} =15000000;