6 messages in com.mysql.lists.perlRE: Problem with executing FirtPerlSc...
FromSent OnAttachments
j zhao19 Sep 2002 16:37 
Zhao, Charles19 Sep 2002 16:53 
Garry Williams19 Sep 2002 22:26 
Greg Meckes20 Sep 2002 03:02 
Greg Meckes20 Sep 2002 07:27 
Garry Williams21 Sep 2002 12:23 
Subject:RE: Problem with executing FirtPerlScript.pl
From:Greg Meckes (greg@yahoo.com)
Date:09/20/2002 07:27:12 AM
List:com.mysql.lists.perl

Actually, it's simply a space for the first thing: DBI-><SPACE HERE>connect

Should be: DBI->connect

Second, try this syntax: my $dbh = DBI->connect($driver:$database, "root", "tacobell") or die "Can't connect";

Hi,

I couldn't execute successfully the perl DBI/DBD example "FirstPerlScript.pl" (attached below) downloaded from MySQL CD-ROM code subdirectory. Did anyone have the experience and figure it out?

The source file and error message are follows. Any responses would be greatly appreciated. Thanks, Jinhua

error message

==========

syntax error at FirstPerlScript.pl line 5, near "$driver:" Unquoted string "database" may clash with future reserved word at FirstPerlScript.pl line 5.

FirstPerlScript.pl

=============

1: #!/usr/bin/perl -w

2: use DBI;

3: $database = "Meet_A_Geek";

4: $driver = "DBI:mysql";

5: my $dbh = DBI-> connect($driver:database=$database, "root", "tacobell") or die "Can't connect";

6: # Insert the values

7: $dbh->do("INSERT INTO Customers (First_Name, Last_Name) VALUES ('Renee', 'Robertson')");

8: $dbh->do("INSERT INTO Customers (First_Name, Last_Name) VALUES ('Larry', 'Isacson')");

9: $dbh->do("INSERT INTO Customers (First_Name, Last_Name) VALUES ('Mark', 'Harrison')");

10: # Disconnect from the database

11: $dbh->disconnect;

12: exit;

To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail msql@lists.mysql.com instead.