Hello A, Wednesday, November 14, 2001, A Taylor <[EMAIL PROTECTED]> wrote:
AT> I am tring to connect to a MySql database and I have been told that I have AT> to include the 'HOSTNAME' (localhost). Can anyone see anything wrong with AT> this code ?????? AT> use DBI; AT> my $database = 'mydatabase@localhost'; AT> my $data_source = "DBI:mysql:$database"; AT> my $username = "username"; AT> my $password = "password"; AT>my $dbh = DBI->connect($data_source, $username, $password) AT> or die "unable to connect to database: " . DBI->errstr; AT> When i run the code, it bombs out at the 'my $dbh = ....' AT> Many many thanks in advance (I have spent days on this !!!!) AT> Anadi DBD::mysql does not allow '@' symbol in your $database. use my $database = 'mydatabase:localhost'; and see perldoc DBD::mysql for more information: $driver = "mysql"; $dsn = "DBI:$driver:database=$database;host=$hostname;port=$port"; $dbh = DBI->connect($dsn, $user, $password); Best wishes, Maxim mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]