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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Detecting a failed DBI connection
by BrowserUk (Patriarch) on Dec 08, 2002 at 22:25 UTC | |
Re: Detecting a failed DBI connection
by pfaut (Priest) on Dec 08, 2002 at 22:27 UTC | |
by Massyn (Hermit) on Dec 08, 2002 at 23:03 UTC | |
by chromatic (Archbishop) on Dec 09, 2002 at 00:08 UTC | |
by pfaut (Priest) on Dec 09, 2002 at 00:10 UTC | |
by mt2k (Hermit) on Dec 09, 2002 at 03:32 UTC | |
by pfaut (Priest) on Dec 09, 2002 at 03:46 UTC |
Back to
Seekers of Perl Wisdom