i am new to perl and i want to use it with DBI:mysql module. I want to connect to my sql server and do some data manipulation like , insert, update and delete. I read the DBI documention but i cant get through to get my script working. any help is needed. below is my script.
#!/usr/bin/perl
use DBI;
$database="sampledb"; $host="localhost"; $user="db"; $pw="mysql";
$dbh=DBI->connect("DBI:mysql:database=$database;host=$host",$user,$pw, {RaiseError => 1});
my $sth = $dbh->prepare(q{INSERT INTO USERS (USERNAME,PASSWORD,DESCRIPTION,ATTRIBUTES) VALUES (?, ?, ?, ?)
}) or die $dbh->errstr;
while (<>) {
chomp;
my ($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE) = split /,/;
$sth->execute($USERNAME,$PASSWORD,$DESCRIPTION,$ATTRIBUTE) or die $dbh->errstr;
}
$dbh->commit or die $dbh->errstr;
$dbh->disconnect;
--------------
Thanks.
Jaws
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]