CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI:
Attempted database (mysql) connection brings up a blank screen


New User

Mar 16, 2004, 5:45 PM

Post #1 of 4 (9698 views)
Attempted database (mysql) connection brings up a blank screen Can't Post

The code:

print "Content-type:text/html", "\n\n";

use DBI;

# set the data source name
# format: dbi:db type:db name:host:port
# mysqlís default port is 3306
# if you are running mysql on another host or port,
# you must change it
my $dsn = '';

# set the user and password
my $user = 'peterhawkes';
my $pass = '*****';

# now connect and get a database handle
my $dbh = DBI->connect($dsn, $user, $pass)
or die "Canít connect to the DB: $DBI->errstr \n";

print "Successful MySQL DB Connection <BR> \n";

exit 0;


Have to trust my password is correct.
I have tried and localhost for the hostname (which have been verified by seanet as correct).
I have tried MySQL as MySQL and mysql (worried about case sensitive issues) and DBI as DBI and dbi.
I use AceFTP for FTP'ing of files to my seanet webserver.

Had problems initally FTP'ing perl scripts at the beginning, but used ASCII and changed the properties on perl scripts to READ all, WRITE user, EXECUTE all.

My belief is that it cannot connect and the error does not show up in the html.

I was wondering if the problem was in the way I FTP the script OR the properties associated with the file?

Anyone got ideas why I return a blank webpage page from this?


Thaumaturge / Moderator

Mar 16, 2004, 10:57 PM

Post #2 of 4 (9697 views)
Re: [peterhawkes] Attempted database (mysql) connection brings up a blank screen [In reply to] Can't Post

The error message is probably ending up in you web server error log. Have you tried looking in there?

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks

New User

Mar 16, 2004, 11:30 PM

Post #3 of 4 (9695 views)
Re: [davorg] Attempted database (mysql) connection brings up a blank screen [In reply to] Can't Post

I am having the web server log retrieved.

Thank you for this lead.

Can we rule out the way I FTP the scripts to the web server (in ASCII)?

New User

Mar 17, 2004, 2:50 PM

Post #4 of 4 (9690 views)
Re: [peterhawkes] Attempted database (mysql) connection brings up a blank screen [In reply to] Can't Post

Well looking at the logs explained everything and then talking to the person who initially gave me the host name information was not correct.

it was

but this information made little difference as looking in the log, their server does not support Perl->DBI applications.

Can't locate object method "connect" via package "DBI" at line 16.
install_driver(mysql) failed: Can't load '/usr/libdata/perl5/site_perl/i386-bsdos/auto/DBD/mysql/' for module DBD::mysql: File not found at /usr/libdata/perl5/5.00503/i386-bsdos/ line 169.

I'm a bit disgruntled by this. I knew my code was fine...above was just a snippet of the larger code. Originally I used an MSAccess ODBC connection on my local webserver at home, but FTP'ing it to the webserver at seanet brought these complications. A great learning experience ! For all perl coders, your code may be right, but they may not have the drivers ;-).

On a side note, I installed this great windows connector app from which allows you to test mysql ODBC connections putting in hostname, port no, database name, user name, and password. You hit the test button to see if the database connects or not ! Then you know whether they have the mysql drivers you need ;-)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives