Re: MySql +DBI problem



ok ok :) sorry for not posting the code

no of lines inserted varies on each execution

#===============================
#!/usr/bin/perl


use Socket;
use DBI;
use CGI qw/:standard/;

$query=new CGI;

print $query->header;


# Connect to the database.
my $dbh = DBI->connect("DBI:mysql:database=database
name;host=hostname",
"username", "password",
{'RaiseError' => 1})|| print "ERROR
CONNECTING";






open(FREADER,"csvfile.csv") or print "ERROR OPENING FILE \n";
if(!($error))
{
my $ln;
my $separator=$/;
undef $/;
$buff=<FREADER>;
$/=$separator;
undef $ln;
close FREADER;
}
my $ln;
my $i=1;


foreach $ln (split("\n",$buff))
{
$buff=~/REG EXP FOR SPLITTING EACH LINE/g;


my $qry="INSERT INTO IP(A,B, C, D, E, F, G, H )
VALUES('$i','$1','$2','$8','$9','$14','$17',".$dbh->quote($20).")";
$dbh->do($qry);


$i++;
}

print $i;
my $errstr=$dbh->errstr;
print $errstr;


$sth->finish();

# Disconnect from the database.
$dbh->disconnect();



close(MAILREADER);






usenet@xxxxxxxxxxxxxxx wrote:
uttamhoode@xxxxxxxxx wrote:
when i execute the script only aroud 31000 to 37000(varies each time)
lines are inserted....I am using a remote mysql server

You have an error on line 42.

And you're not checking your SQL return messages on lines 92, 111, and
141 (hint, hint).

--
David Filmer (http://DavidFilmer.com)

.



Relevant Pages