Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Choosing the correct mysql server to connect to

Reply
Thread Tools

Choosing the correct mysql server to connect to

 
 
skieros
Guest
Posts: n/a
 
      04-16-2007
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.

 
Reply With Quote
 
 
 
 
Matt Garrish
Guest
Posts: n/a
 
      04-16-2007
On Apr 16, 8:08 am, "skieros" <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
connect a database in remote server (can connect to the server via SSH) zhangxiaoyu912@gmail.com Perl Misc 2 07-18-2007 07:20 PM
using mysql client to read a file to create a table in a database in a mysql server julian Ruby 8 04-06-2006 10:29 AM
MySQL Bindings, Pather Server, existing MySQL - help Brian Ablaza Ruby 1 02-27-2006 08:32 PM
Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock' Allen Marshall Perl Misc 1 01-24-2004 10:55 PM
Price List for MOM & POP when choosing between MySql/PHP and .NET nospam ASP .Net 13 09-27-2003 04:55 AM



Advertisments