Wayne,
You should probably post this to the DBI users list ([email protected]).
Your connect string seems to be missing the name of your database.
Give string values to the variables: $database_name and $database_location and to $username and $pass which are used below.
Here's how I connect:
$dsn="DBI:mysql:$database_name:$database_location"; $dbh=DBI->connect($dsn, $username, $pass) or die "Couldn't connect.";
Paul
>From the DBD::mysql docs example:
$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; $dbh = DBI->connect($dsn, $user, $password);
I think you need to specify your connect string like that.
-Wayne
-----Original Message----- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Monday, January 03, 2005 6:34 PM To: [email protected] Subject: perl & MySQL
I am making my first attempt to access MySQL with Perl
#!/perl use warnings; use strict; use dbi;
my $dbh=DBI->connect( 'dbi:MySQL, 'user', 'pass' ) or die "Cannot connect -> !<br>$DBI::errstr";
and I get the following error:
Can't connect to data source dbi:MySQL, no data driver specified and DBS_DSN env var not set
Any ideas?
Thanks,
Jerry
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
-- Sincerely,
Paul Appleby
(416) 530-0070 http://www.paulappleby.com http://myspider.ca _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
