Hi All,
I'm having some trouble connecting to mysql database. Here is a copy of
the script I'm using... One of the errors I'm getting is "no database
driver specified". Any help would be greatly appreciated. Thanks!
Brian
[EMAIL PROTECTED]
#!/usr/bin/perl
use DBI;
# Gather some information from the user :
print "Enter your MySQL username: ";
$username = <STDIN>;
print "Enter your MySQL password; ";
$password = <STDIN>;
# Connect to the database
my $dbh = DBI->connect ( "DBD:mysql :database=perl :host=localhost",
$username,
$password) || die "Couldn't connect to database";
print "Database connection established."
# Perpare statement
my $sth = $dbh->prepare( "SELECT * FROM perl_table" );
# Send statement to database
$sth->execute || die "Couldn't execute statement";
# Print out the data
my @row
while ( @row = $sth->fetchrow_array() ) {
print "@row \n";
}
# One more thing: we need to disconnect from the database server
# when we're done.
$dbh->disconnect;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]