[CONJ-264] SQLException when calling PreparedStatement.executeBatch() without calling addBatch() Created: 2016-03-04  Updated: 2016-03-07  Resolved: 2016-03-07

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.3.6
Fix Version/s: 1.3.7

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

In trying to migrate an application from MySQL to MariaDB, a user believs that they have found a bug in the MariaDB 1.3.6 java connector. If a program calls PreparedStatement.executeBatch() without any prior associated calls to PreparedStatement.addBatch() a SQLException is thrown:

java.sql.SQLException: No Parameters set. The command addBatch() must have been set

This exception is not thrown when using the MySQL connector or when using the older MariaDB 1.2.3 connector. The user's application also supports other RDBMS providers and this exception is not thrown by any of their connectors in this situation either. The Java API does not explicitly address this case in its description of the executeBatch() method but the fact that all other JDBC drivers handle this situation without an exception being thrown leads me to conclude that this is a bug with the MariaDB 1.3.6 connector.



 Comments   
Comment by Diego Dupin [ 2016-03-07 ]

You are right, there is a difference using client prepared statement and server prepared statement.
When no addBatch add been done, client return immediatly int[0], server throw an exception.

Server return immediatly int[0] the same way.

commit : https://github.com/MariaDB/mariadb-connector-j/commit/6634fa5c70ea22a55220e2e24a78d5021486e642

Generated at Thu Feb 08 03:14:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.