Here's a test script that I use to check out a new
database whenever I create a new one:
#!/usr/bin/perl
use DBI;
$database = "oncall";
$user = "oncall";
$code = "1donca";
print "INFO: Connecting to database: $database\n";
$connection = DBI->connect("DBI:mysql:$database",
$user, $cod
I think you're missing the server information in your script. If it's on
the same machine as the mysql server then localhost would probably work
fine.
ie
my ($dsn) = "DBI:mysql:databasename:localhost";
my ($username) = "username";
my ($pass) = "password";
$dbh = DBI->connect ($dsn, $username, $pa
All
i wrote the following perl script and tried to connect to mysql database:
# File name fig13.pl
#!/usr/bin/perl -w
use DBI;
$dbh = DBI->connect("DBI:mysql:zipcodes","username","mypass");
if ($dbh) {
print "Connection successful\n";
}
then after giving execute permission, i tried to run it by