Re: Problem with perl script
Ok, i understand this but i have not much experience with perl scripting, maybe someone can help me with this.
this is the script.
#--------------------------------------------------------------------------
#!/usr/bin/perl -w
use DBI;
my $host = "localhost";
my $db = "world";
my $db_user = "root";
my $db_password = "";
my $dbh = DBI->connect('dbi:mysql:world:localhost:3306',$db_user, $db_password)
|| die "Kan geen verbinding maken met de SQL server.";
$Counter=1;
$ID=1;
$Name="GhostTown";
$CountryCode="BEL";
$District="Antwerpen";
$Population=1;
while ($Teller<=10000)
{
$sqlstatement="INSERT INTO City (`ID`, `Name`,`CountryCode`,`District`,`Population`) VALUES ($ID,\" $Name \",\" $CountryCode \",\" $District \", $Population)";
$sth = $dbh->prepare($sqlstatement);
print "De rij met id: $ID \tis toegevoegd in tabel City\n ";
$sth->execute || die print "Fout in de SQL query $sqlstatement, probeer het opnieuw";
$Counter++;
$ID++;
$Population=$Teller*0.2;
}
$dbh->disconnect();
#--------------------------------------------------------------------------
so how can i check if $sth->execute || die print "error";
went ok and let the rest of the script execute on the surviving node ???
Subject
Views
Written By
Posted
3456
April 11, 2005 08:44AM
1988
April 11, 2005 03:55PM
Re: Problem with perl script
2031
April 14, 2005 08:18AM
1938
April 14, 2005 08:58AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.