OCILobLocatorPtr problem
From: Thomas Upton (thupton2002_at_yahoo.com)
Date: 04/20/04
- Next message: Jeff Urlwin: "RE: :ODBC Connection no longer working"
- Previous message: jamiescot_at_su.shawcable.net: "Lola Eurobabe getting her tits out"
- Next in thread: Mark Galbraith: "RE: OCILobLocatorPtr problem"
- Maybe reply: Mark Galbraith: "RE: OCILobLocatorPtr problem"
- Reply: Felix Castillo Sanchez: "Re: OCILobLocatorPtr problem"
- Reply: Felix Castillo Sanchez: "Re: OCILobLocatorPtr problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Apr 2004 13:52:28 -0700 (PDT) To: dbi-users@perl.org
I apologize in advance for being new to perl and Oracle.
I have to be missing something but I can't figure out what it is. I am running perl 5.8.3 on a Solaris 8 64bit server with DBI 1.42 and DBD::Oracle 1.15. My scripts that access and update an oracle DB work just find. I run into problems when I tried to run the lob_example code. Here is my code.
my %DB = ( sid => 'test',
user => 'tester',
pw=> '11111111',
host=>'10.10.10.10' );
my $dbh=DBI->connect("dbi:Oracle:",$DB{user},$DB{pw},{RaiseError=>1,PrintError=>1});
my $lob_id = $dbh->selectrow_array( <<" SQL" );
SELECT lob_example_seq.nextval FROM DUAL
SQL
my $sth = $dbh->prepare( <<" SQL" );
INSERT INTO lob_example
( lob_id, bindata, chardata )
VALUES ( ?, ?, ? )
SQL
$sth->execute( $lob_id, '', '' );
$sth = $dbh->prepare( <<" SQL", { ora_auto_lob => 0 } );
SELECT bindata, chardata
FROM lob_example
WHERE lob_id = ?
FOR UPDATE
SQL
$sth->execute( $lob_id );
my ( $bin_locator, $char_locator ) = $sth->fetchrow_array();
$sth->finish();
open BIN_FH, "/usr/sbin/ifconfig" or die;
open CHAR_FH, "/etc/path_to_inst" or die;
my $chunk_size = 4096; # Arbitrary chunk size
# BEGIN WRITING BIN_DATA COLUMN
my $offset = 1; # Offsets start at 1, not 0
my $length = 0;
my $buffer = '';
while( $length = read( BIN_FH, $buffer, $chunk_size ) ) {
$dbh->ora_lob_write( $bin_locator, $offset, $length );
$offset += $length;
}
# BEGIN WRITING CHAR_DATA COLUMN
$offset = 1; # Offsets start at 1, not 0
$length = 0;
$buffer = '';
while( $length = read( CHAR_FH, $buffer, $chunk_size ) ) {
$dbh->ora_lob_write( $char_locator, $offset, $length );
$offset += $length;
}
When I run this I get the following error
locator is not of type OCILobLocatorPtr at line 51
Line 51 containts the ora_lob_write on the BLOB.
What am I missing?
Be gentle :)
Bobby
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
- Next message: Jeff Urlwin: "RE: :ODBC Connection no longer working"
- Previous message: jamiescot_at_su.shawcable.net: "Lola Eurobabe getting her tits out"
- Next in thread: Mark Galbraith: "RE: OCILobLocatorPtr problem"
- Maybe reply: Mark Galbraith: "RE: OCILobLocatorPtr problem"
- Reply: Felix Castillo Sanchez: "Re: OCILobLocatorPtr problem"
- Reply: Felix Castillo Sanchez: "Re: OCILobLocatorPtr problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|