I never include localhost as part of my destination, I include a trailing ":" after the database name and I always encapsulate each argument in double quotes, as below:
our $dbh = DBI->connect("dbi:mysql:asi:","web_isur","web_update") || die "Can't connect to asi: $!"; Even with variables as arguments, I think quoting will help, if it's not actually mandatory. I don't think "my" or "our" makes a difference in this case. Hope this helps. Joe > -----Original Message----- > From: A Taylor [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 14, 2001 6:44 AM > To: [EMAIL PROTECTED] > Subject: HELP - I am trying to connect to a MySql database > > > I am tring to connect to a MySql database and I have been > told that I have > to include the 'HOSTNAME' (localhost). Can anyone see > anything wrong with > this code ?????? > > use DBI; > > my $database = 'mydatabase@localhost'; > my $data_source = "DBI:mysql:$database"; > my $username = "username"; > my $password = "password"; > > my $dbh = DBI->connect($data_source, $username, $password) > or die "unable to connect to database: " . DBI->errstr; > > When i run the code, it bombs out at the 'my $dbh = ....' > > Many many thanks in advance (I have spent days on this !!!!) > Anadi > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at > http://explorer.msn.com/intl.asp > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]