Choosing the correct mysql server to connect to

S

skieros

my $dbh = DBI->connect('DBI:mysql:;host=mysql3.freehostia.com',
'nikkou6', 'tiabhp2r', {RaiseError=>1});
or
my $dbh = DBI->connect('DBI:mysql:' 'root', 'tiabhp2r',
{RaiseError=>1});

Is the above likely to work?
I made it liek these so for init.pl to have a knowledge of wether it
runs on localhost or on freehostia.com which is my remote hosting
company.

For some reason it aitn working...but i dnt see the error.
 
M

Matt Garrish

my $dbh = DBI->connect('DBI:mysql:;host=mysql3.freehostia.com',
'nikkou6', 'tiabhp2r', {RaiseError=>1});
or
my $dbh = DBI->connect('DBI:mysql:' 'root', 'tiabhp2r',
{RaiseError=>1});

Is the above likely to work?

I would expect that when connecting to MySQL without specifying a
database you will connect by default to the "mysql" database (if the
lack of a default database isn't the error; never tried), and I doubt
very highly that your host would allow you in there. You might try
adding a die statement if you don't get a handle so you know what went
wrong and so your code doesn't continue on when it shouldn't:

my $dbh = DBI->connect() or die $DBI::errstr;

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top