Hi Jaws (!?), You don't say where your script is failing, or what errors it's reporting, which is going to make it hard for anyone to help. You could add some better error checking. Here's a couple of lines lifted from one of my CGI's.
my $dbh; eval { $dbh = DBI->connect( $DATA_SOURCE, $DB_USER, $DB_PASSWORD, { RaiseError => 1, AutoCommit => 1 } ) }; if ($@) { print "Failed in connecting to database, see following error<br/>\n"; print $@ . "<br/>\n"; return; } Perhaps you could add something like this to your script to get a better idea of what's not working. You can put this type of error checking around your compare and execute statements as well. Good Luck Rob "Jaws" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > 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]