Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.0.1
-
None
-
10.2.6-MariaDB
Description
I try to create a timeout exception with the current mariadb connector.
For this i create a select statement with the sleep value of 50 seconds but a querytimeout value of 1.
the query runs all the 50 seconds and has a return value - see log information "has next"
Is the handling from my side correct?
final String sql = "SELECT sleep(50)"; |
|
try (final PreparedStatement preparedStatement = dbCon.getPreparedStatement(sql)) { |
logger.info("### Prepared Statement: " + preparedStatement); |
|
preparedStatement.setQueryTimeout(1); |
final ResultSet rowset = preparedStatement.executeQuery(); |
logger.info("### Finsih Statement: " + rowset.toString()); |
logger.info("### Has next: " + rowset.next()); |
} catch (final Exception e) { |
logger.severe(e.getMessage());
|
}
|
|
try (final Statement statement = dbCon.getStatement()) { |
logger.info("### Statement: " + statement ); |
|
statement .setQueryTimeout(1); |
final ResultSet rowset = statement .executeQuery(sql); |
logger.info("### Finsih Statement: " + rowset.toString()); |
logger.info("### Has next: " + rowset.next()); |
} catch (final Exception e) { |
logger.severe(e.getMessage());
|
}
|
Jun 02, 2017 9:42:48 AM com.mariadb.conj.QueryTimeoutIssue selectEntry
|
INFORMATION: ### Prepared Statement: sql : 'SELECT sleep(50)', parameters : []
|
Jun 02, 2017 9:43:38 AM com.mariadb.conj.QueryTimeoutIssue selectEntry
|
INFORMATION: ### Finsih Statement: org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet@4629104a
|
Jun 02, 2017 9:43:38 AM com.mariadb.conj.QueryTimeoutIssue selectEntry
|
INFORMATION: ### Has next: true
|
Jun 02, 2017 9:43:38 AM com.mariadb.conj.QueryTimeoutIssue selectEntry
|
INFORMATION: ### Statement: org.mariadb.jdbc.MariaDbStatement@27f8302d
|
Jun 02, 2017 9:43:39 AM com.mariadb.conj.QueryTimeoutIssue selectEntry
|
INFORMATION: ### Finsih Statement: org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet@4d76f3f8
|
Jun 02, 2017 9:43:39 AM com.mariadb.conj.QueryTimeoutIssue selectEntry
|
INFORMATION: ### Has next: true
|