in reply to Preventing database handles from going stale

You could wrap the code where you are actually using the database in an eval block to trap the error, and then when an exception occurs you can just re-connect and try again. (Assuming you are using the RaiseError option, anyway -- otherwise just check the return value from your DBI calls.)

-- David Irving

Replies are listed 'Best First'.
Re^2: Preventing database handles from going stale
by dsheroh (Monsignor) on Feb 05, 2007 at 17:41 UTC
    That would definitely work for handling the timeouts, but I'd prefer to prevent them if possible. (Postgres allows 100 concurrent connections by default and I don't think I've ever used more than 3 of them at a time, so having one just hang out and rarely get used is not an issue.)