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

Hi, all!

I am pretty handy DBI/DBD, but I have a question. I am currently writing some scripts to read/write CLOB and BLOB fields to an Oracle 8 database. The version of the Oracle DBD we are using does not support these LOB types. Obviously, the preferred solution is to upgrade DBD, but (it's a long story) this is not feasible for the current project. Further, we do not want to use LONG and LONG RAW data types.

I hear rumors and whispers that it might be possible to either trick or bypass the DBD to access the fields with the older version of the DBD, but no one can tell how (or even definitively whether) this is actually possible.

Any thoughts? Thanks!

BNJ

Edited: footpad, 26 Aug 01 - ~21:35 (PDT)

Replies are listed 'Best First'.
Re: CLOBs/BLOBs in DBD
by blakem (Monsignor) on Aug 27, 2001 at 06:48 UTC
    Don't know which version of DBI you are using, but here is a snippet I'm using with DBI 1.19 that enables me to read and write LOBs.
    sub ora_connect { my $user = shift; my $sid = shift; my ($login,$pass,$sid,$hostname) = ora_vars($user,$sid); my $dbh = DBI->connect("DBI:Oracle:", "$login\@$sid", $pass); die "Couldn't connect to Oracle: $!" unless $dbh; $dbh->{LongReadLen} = 66000; $dbh->{LongTruncOk} = 1; return $dbh; }
    Oh, and ora_vars is a home grown subroutine that looks up passwords and sids based on who is running the script and what machine its on.

    -Blake