Here is my code but i receive the message that only 6 byes have been read
What is wrong? Could anyone enlighten me?
-------------------------------------------------------------------
use DBI;


$LONG_RAW_TYPE=24; # Oracle type id for blobs


$dbh = DBI->connect( "DBI:Oracle:host=$host;sid=$sid", $username, $password)
                or die "Connecting : $DBI::errstr\n ";






        open(BLOB, "john.doc");
        $bytes = 0;
        $bytes = read(BLOB, $buf, 500000);

        print STDERR "Read $bytes bytes...\n";
        close(BLOB);
        
        $stmt = $db->prepare("INSERT INTO hr.documents (documentid , 
document_name, document) VALUES ('1','john.doc','$bytes')") || die "\nPrepare 
error: $DBI::err .... $DBI::errstr\n";

        # Bind variable.  Note that long raw (blob) values must have their 
attrib explicitly specified
        $attrib{'ora_type'} = $LONG_RAW_TYPE;
        $stmt->bind_param("john.doc", $buf, \%attrib);  

        $stmt->execute() || die "\nExecute error: $DBI::err .... 
$DBI::errstr\n";

        print STDERR "Complete.\n";
-----------------------------------------------------------------------

Reply via email to