ehdonhon has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I'm writing some code that makes database connections for me, I want it to be robust enough to retry the connection if it fails without having to wait the default DBI timeout period.
Is it possible to set the timeout value for DBI::connect()? If not, is it safe to alarm out of a connect(), or is there a better way? The pod does discuss alarm signals, but does not describe using them with a connect().
Also, do DBI database handles have a method to test if the connection to the database is active? I'd like to be able to do this both to make sure my connection was successful and also later to make sure the connection didn't drop. I'm assuming that since Apache::DBI is smart enough to re-create connections whenever they drop that it must have some way of doing this.
Thanks for any help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI Timeout and Retry on Connect
by maverick (Curate) on Mar 14, 2002 at 23:29 UTC | |
by ehdonhon (Curate) on Mar 14, 2002 at 23:38 UTC | |
|
Re: DBI Timeout and Retry on Connect
by perrin (Chancellor) on Mar 14, 2002 at 23:31 UTC |