#!usr/bin/perl use DBI; use strict; my $one="one"; my $two="two"; my $three="three"; my $four="four"; # connect to the database, assigning the result to $dbh my $database="globalid"; my $host="autolabserver"; my $port="3306"; #connect to the database, assigning the result to $dbh my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host;port=$port", 'tester','auto55'); # die if we failed to connect die "Can't connect: " . DBI->errstr() unless $dbh; # all is well! print "Success: connected!\n"; my $sth = $dbh->prepare('INSERT INTO headerinfo (GLOBALID,DECIMAL,CONVERTED,COMMENT) VALUES(?,?,?,?)') or die "Can't prepare SQL: " . $dbh->errstr(); $sth->execute($one,$two,$three,$four) or die "Can't execute SQL: " . $sth->errstr(); # finish and disconnect $dbh->disconnect(); print "finished"; #### Success: connected! finished C:\Documents and Settings\tester\Desktop\from diarmuid>perl connect.pl Success: connected! DBD::mysql::st execute failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECIMAL,CONVERTED,COMMENT) VALUES('one at connect.pl line 28. Can't execute SQL: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECIM AL,CONVERTED,COMMENT) VALUES('one at connect.pl line 28. #### #$sth->execute($one,$two,$three,$four) # or die "Can't execute SQL: " . $sth->errstr();