----- Original Message -----
From: Bob T
To: [EMAIL PROTECTED]
Sent: Thursday, March 21, 2002 11:08 PM
Subject: DBI w/ DBD:ODBC or DBD:mysql or DBIx-AnyDBD
I am new to Perl DBI programming it is fairly simple..Except I am not
sure I am set up correctly or am using the correct module combinations...
I am using both Mysql 3.23.44nt and 3.23.43 Linux..as well as PostgreSQL
7.1 Linux and on WinXP on Cygwin.
Perl on Linux was straight forward but the Perl on WIn is a bit Different.
I ran a simple script to insert records in a table as test and it worked but I am
unsure that the WinXP install of Perl and DBI is correct that is do I have the
correct modules in place. Should I be running the date through a DBD:ODBC or a
DBD:mysql.
Below is my PPM query to my Perl Package Manager:
Settings\bobby\Application Data\ActiveState\ActiveState.lic' is present.
ppm> query DBI
Querying target 1 (ActivePerl 630)
1. DBI [1.14] Database independent interface for Perl
2. DBIx-AnyDBD [1.98] DBD independant class
3. DBIx-Easy [0.10] Easy to Use DBI interface
ppm> query DBD
Querying target 1 (ActivePerl 630)
1. DBD-ODBC [0.28] ODBC driver for the DBI module.
2. DBIx-AnyDBD [1.98] DBD independant class
ppm>
My test Perl Script...
#!/perl/bin/perl -w
use DBI;
my $dbh = DBI-> connect( "DBI:mysql:Meet_A_Geek", "bobby", "bobby") or die "Can't
connect";
# Insert the values
$dbh->do("INSERT INTO customers (First_Name, Last_Name) VALUES ('Renee',
'Robertson')");
$dbh->do("INSERT INTO customers (First_Name, Last_Name) VALUES ('Larry', 'Isacson')");
$dbh->do("INSERT INTO customers (First_Name, Last_Name) VALUES ('Mark', 'Harrison')");
# Disconnect from the database
$dbh->disconnect;
exit;
AND Lastly... When I replace the first 7 lines like so... I get a failure
#!/perl/bin/perl -w
use DBI;
$database = "Meet_A_Geek";
$driver = "DBI:mysql";
my $dbh = DBI-> connect( "$driver:$database", "bobby", "bobby") or die "Can't connect";
The error referred to database not being quoted but then after I used the first script
to establish a connection the second script worked???
Sorry for the multiple questions ..Can anyone Help..
Bob T.