Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
3.5.10
-
None
-
MySQL using useServerPrepStmts: true option
Description
After upgrading MariaDB Connector/J from 2.7.x to 3.5.10, our application started encountering this error:
Can't create more than max_prepared_stmt_count statements
While reviewing the 3.5.10 code, I noticed that when ServerPreparedStatement.executeInternal encounters an SQLPrepareException, it falls back to ClientPreparedStatement through clientFailover. However, executeInternalPreparedBatch appears to propagate the exception to the application without the same fallback.
Is this difference intentional?
If propagating the exception to the application is a bug, would it be okay for me to submit a PR that adds the same fallback to ClientPreparedStatement for batch execution?
[ERROR message]
SQLGrammarException (JPA error)
cloud not execute batch [(conn=1) Can't create more than max_prepared_stmt_count statements (Current value: 1]
SQLPrepareException (mariadb connector)
(conn=1) Can't create more than max_prepared_stmt_count statements (current value: 1)
org.mariadb.jdbc.export.ExceptionFactory in createException at line 290
org.mariadb.jdbc.export.ExceptionFactory in create
org.mariadb.jdbc.message.client.PreparePacket in readPacket at line 75
org.mariadb.jdbc.client.impl.StandardClient in readPacket
org.mariadb.jdbc.client.impl.StandardClient in readResults
org.mariadb.jdbc.client.impl.StandardClient in readResponse
org.mariadb.jdbc.client.impl.StandardClient in execute
org.mariadb.jdbc.client.impl.StandardClient in execute
org.mariadb.jdbc.ServerPreparedStatement in executeBatchPipeline at line 225
org.mariadb.jdbc.ServerPreparedStatement in executeInternalPreparedBatch at line 208
org.mariadb.jdbc.BasePreparedStatement in executeBatchInternal
org.mariadb.jdbc.BasePreparedStatement in executeBatch
com.zaxxer.hikari.pool.ProxyStatement in executeBatch
com.zaxxer.hikari.pool.HikariProxyPreparedStatement in executeBatch