Bug #73216 Non-JDBC4 MySQLTimeoutException timeout exception is thrown
Submitted: 6 Jul 2014 9:07 Modified: 6 Jul 2014 20:38
Reporter: Francisco Lozano Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.31 OS:Any
Assigned to: CPU Architecture:Any
Tags: timeout

[6 Jul 2014 9:07] Francisco Lozano
Description:
StatementImpl throws a MySQLTimeoutException instead of the proper JDBC4 version of the exception:

				synchronized (this.cancelTimeoutMutex) {
					if (this.wasCancelled) {
						SQLException cause = null;
						
						if (this.wasCancelledByTimeout) {
							cause = new MySQLTimeoutException();
						} else {
							cause = new MySQLStatementCancelledException();
						}
						
						resetCancelledState();
						
						throw cause;
					}
				}

How to repeat:
SELECT SLEEP(10) in a query with a timeout of 5

Suggested fix:
Throw the proper exception if in JDBC4 environment
[6 Jul 2014 10:25] Filipe Silva
Hi Francisco,

Thank you for this bug report.
[6 Jul 2014 15:57] Mark Matthews
This is a duplicate of Bug#71589.
[6 Jul 2014 20:38] Francisco Lozano
I am not sure it's a duplicate. There are *two* MySQLTimeoutException
- com.mysql.jdbc.exceptions.MySQLTimeoutException
- com.mysql.jdbc.exceptions.jdbc4.MySQLTimeoutException.

Original issue just talks about creating 2nd one.

This bug is about the 2nd one not being used.