Hello,
I am using DBD:sybase driver and trying to insert text file into database
(ms-sql). I am able to insert the file without any error, but when i
retrieve it, i get only half the file, so i verified and it seems that while
insertion only, it gets inserted half the file and not the full. I am not
sure what is preventing it to insert full file. text file is not that large
(only 9000 bytes).
here is the codes i am using.
#!/usr/local/bin/perl
$ENV{SYBASE} = '/usr/local';
use DBI;
use lib "/thishost/unix/cen/wftools";
$XML_FILE = "test.xml" ;
$size = -s $XML_FILE ;
open (INPUT,"<$XML_FILE") || die "Cannot open $XML_FILE\n";
while (<INPUT>)
{
$file = $file . "$_" ;
}
close(INPUT);
$DATABASE = "SC_Res";
$RO_USER = "shc" ;
$RO_PASSWORD = "shc_r#" ;
$dbh = DBI->connect("dbi:Sybase:SYBASE:database=$DATABASE", $RO_USER,
$RO_PASSWORD) || die $DBI::errstr;
$quoted = $dbh->quote($file);
$dbh->{LongReadLen} = 10000000000000000;
$sth = $dbh->prepare(qq(
insert into
CrawlerRawData(CrawlerID,CrawlerScheduleID,DataCollectionDatetime, RawData)
values (3,8,'2003-06-26',$quoted)
));
$sth->execute;
$sth->finish;
$dbh->disconnect ;