Jason Winnebeck wrote:
> Doesn't the Connector/J Driver have an
> auto-reconnect functionality for cases like these?
> Of course the server can be down for a long time,
> but you seem to imply that any proper execution of
> a SQL statement should be in a loop until it
> succeeds (or you give up).
Jason,
autoReconnect is there, but can only handle very limited failure scenarios. I myself would only use it for read-only applications, as if you're changing data, you want to make sure things happen in exactly the order you think they do, and that the database (as far as your application is concerned) goes from one known state to another.
If you handle exceptions incorrectly in your application, and at the same time, 'autoReconnect=true' could fool your app into thinking a connection (and thus a transaction) has been in place the entire time, thus leaving your application thinking it's working with one version of the data (before the connection died, and the transaction up to that point was rolled back by MySQL), while something different exists in the database.
-Mark
Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html