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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



peterhawkes
New User

Mar 16, 2004, 5:45 PM

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

The code:

#!/usr/bin/perl
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 = 'DBI:MySQL:peterhawkesDB:mysql.seanet.com:3306';

# 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;

Assumptions:

Have to trust my password is correct.
I have tried mysql.seanet.com 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?

[peterhawkes@yahoo.com]


davorg
Thaumaturge / Moderator

Mar 16, 2004, 10:57 PM

Post #2 of 4 (4604 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
http://www.dave.org.uk/
Get more help at Perl Monks


peterhawkes
New User

Mar 16, 2004, 11:30 PM

Post #3 of 4 (4602 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)?


peterhawkes
New User

Mar 17, 2004, 2:50 PM

Post #4 of 4 (4597 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 bosco.seanet.com

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 databaseconnectionmethod2.pl line 16.
install_driver(mysql) failed: Can't load '/usr/libdata/perl5/site_perl/i386-bsdos/auto/DBD/mysql/mysql.so' for module DBD::mysql: File not found at /usr/libdata/perl5/5.00503/i386-bsdos/DynaLoader.pm 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 mysql.com 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