Streaming query swallowing SQLException
Intermittent errors from our code are being swallowed someplace during streaming and causing the streaming to hang. I'm fairly certain it's occurring under `ResultSet.next`.
Is this a known problem? Is there a known workaround? We've tried catching and rethrowing the errors as other errors. They get caught but they still get muted.
Can someone point me to the streaming implementation of `ResultSet.next`? It's probably not actually that but whatever implements `this.rowData.next()`. I am curious whether com.mysql.cj.jdbc.result.ResultSetImpl#clearWarnings may be a causal agent.
The kotlin version of the iteration with annotation
``` kotlin
database.dirtyExecuteExpression(expression) { statement ->
logger.debug { "Running query: $statement" }
if (database.dialect is MySqlDialect) statement.fetchSize = Integer.MIN_VALUE
statement.queryTimeout = 0 // no timeout
try {
statement.executeQuery().use { rs ->
logger.debug { "Query: $rs" }
while (rs.next()) {
try {
action(rs)
} catch (e: SQLException) {
// catches the error but the throw hangs rather than exits the iteration
logger.error(e) { "Error during suspendable query $statement on ${statement.connection}" }
throw e
}
}
}
} catch (e: SQLException) {
// catches the eventual socket disconnect error
logger.error(e) { "Outer error during suspendable query $statement on ${statement.connection}" }
throw e
}
}
```
Subject
Written By
Posted
Streaming query swallowing SQLException
February 11, 2025 07:12AM
February 10, 2026 01:31PM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.