Hi Gerald,

Check your syntax, I can't see the hostname or database name in your
connect statement. I have a statement similar to that below. Note the
hostname and database.

my %err_handle = (
        PrintError      => 1,
        RaiseError      => 1
                );

$dsn = "DBI:mysql:host=$hostname;database=lcscreative;";
$dbh = DBI->connect($dsn, 'username', 'password', \%err_handle);

Check you installed the DBD::mysql driver? You can get the latest
version via CPAN. If you are running *nix, use

perl -e shell -MCPAN 

cpan>install DBD::mysql

--- lots of output ---

Read the README as there are several requirements for testing eg. a user
and access to a test database.

Regards

David Logan
Database Administrator
HP Managed Services
148 Frome Street,
Adelaide 5000
Australia

+61 8 8408 4273 - Work
+61 417 268 665 - Mobile
+61 8 8408 4259 - Fax


-----Original Message-----
From: Gerald Preston [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 4 January 2005 12:10 PM
To: mysql users
Subject: first time accessing

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

 

 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to