6 messages in com.mysql.lists.perlRE: Problem with executing FirtPerlSc...| From | Sent On | Attachments |
|---|---|---|
| j zhao | 19 Sep 2002 16:37 | |
| Zhao, Charles | 19 Sep 2002 16:53 | |
| Garry Williams | 19 Sep 2002 22:26 | |
| Greg Meckes | 20 Sep 2002 03:02 | |
| Greg Meckes | 20 Sep 2002 07:27 | |
| Garry Williams | 21 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;
--------------------------------- Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail
msql...@lists.mysql.com
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.
__________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com




