Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have tried reading the file in to a string, using 'read' but that got me this error and some pages of non readable errors :(my ($conn); my($sample_name, $blob_file); &GetOptions("n=s" =>\$sample_name, "f=s" =>\$blob_file, ); my $db_type = 'test'; # or live my $team = 78; { #conn_setup(); update(); } sub update { my $conn; open(BLOB, $blob_file) ||die "Cannot open the blob file\n"; my $bytes = 0; my $buf; $bytes = read(BLOB, $buf, 500000); print STDERR "Read $bytes bytes\n"; close(BLOB); eval { $conn = Database::Conn->new('live');#module to connect to DB $conn->addConnection(DBI->connect('dbi:Oracle:CANT.world', 'nst_own +er', 'NST_OWNER', {RaiseError => 1, AutoCommit => 0}),'nst'); my $sample_id = $conn->execute('nst::Copynumber::GetCosmicSampleId' +, $sample_name); #print $sample_id; $conn->execute('nst::Copynumber::InsertContourPlots',$buf, $sample_ +id); };if($@){ warn "ERROR: ".$@; $conn->rollback; exit; } else { $conn->commit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding a JPEG file to database
by Eliya (Vicar) on Feb 21, 2011 at 19:03 UTC | |
|
Re: Adding a JPEG file to database
by kejohm (Hermit) on Feb 22, 2011 at 04:15 UTC | |
|
Re: Adding a JPEG file to database
by chrestomanci (Priest) on Feb 21, 2011 at 20:26 UTC | |
|
Re: Die silently?
by trwww (Priest) on Feb 21, 2011 at 20:01 UTC |