Massyn has asked for the wisdom of the Perl Monks concerning the following question:
#!/fellow/monks.pl
I have a slight problem connecting via DBI to a mySQL database. Maybe I need to clarify: My connection problem is with mySQL, which I'm on top of, my problem is that the CGI dies, with the error message in the error_log file of Apache. I would like to display this error message via the web browser. Now my question... How can I detect if the DBI connection has failed, and then print the error message out?
#!/usr/bin/perl use DBI; print "Content-type: text/html\n\n"; $server = "127.0.0.1"; $sid = "mysid"; $user = "myuser"; $passwd = "mypassword"; $dbh = DBI->connect("DBI:Oracle:host=$server;sid=$sid", $user, $passwd +); ... ...
Thanks!
#!/massyn.pl
You never know important a backup is until the day you need it.
Back to
Seekers of Perl Wisdom