How to implement automatic reconnection in PDO?

[email protected] (Christian Hammers) Sun, 26 Jul 2009 23:38:12 +0200
Newsgroups php.pdo
Message-ID <[email protected]>
Hello

Any ideas how to implement automatic reconnection in an PDO application?

I want to distinguish between a connection error, after which the
program would sleep 10s and then try a reconnect (at most 3 times)
and everything else like syntax errors which are final. 

Just repeat every command three times would stall the program for e.g.
30s every time an error occurs. This is of course very annoying and
only acceptable in cases where it could really help.

With MySQL I would have checked for SQLSTATE[HY000] or the MySQL
specific code 2002 "Can't connect..."

bye,

-christian-