Bug #71589 MySQLTimeoutException must extend standard JDBC SQLTimeoutException
Submitted: 5 Feb 2014 5:04 Modified: 5 Feb 2014 10:24
Reporter: constantine Linnick Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Filipe Silva CPU Architecture:Any
Tags: exception, java, timeout

[5 Feb 2014 5:04] constantine Linnick
Description:
If we use multiple connectors we cannot use standard sql exceptions to react unified way without vendor-specific classes

How to repeat:
// Create loooooong sql query
try{
Connection connection = getConnection(externalDataSource);
Statement st = connection.createStatement();
st.setQueryTimeout(timeout);
}catch(SQLTimeoutException){
    // we do not get here after timeout
}

Suggested fix:
MySQLTimeoutException extends SQLTimeoutException
[5 Feb 2014 10:24] Filipe Silva
Hi Constantine,

Thank you for this bug report. Verified by code review.
[25 Jun 2015 20:44] Ross Lamont
In Connector/J 5.1.35, PreparedStatement:1931 - throws a hard coded MySQLTimeoutException - should be doing Util.isJdbc4() somewhere.

Also - checkout MySQLStatementCancelledException - same problem