After MariaDB Connector/Java (CONJ) version 1.3.6 (since 1.3.7 and 1.4.0), the INSERT INTO my_table (my_col) VALUES ('my_val')
failed :
Exception in thread "main" java.sql.SQLException: You need to set exactly 1 parameters on the prepared statement
Query is : INSERT INTO my_table (my_col) VALUES ('my_val')null
at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:136)
at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69)
at org.mariadb.jdbc.MariaDbStatement.executeQueryEpilog(MariaDbStatement.java:213)
at org.mariadb.jdbc.MariaDbClientPreparedStatement.executeInternal(MariaDbClientPreparedStatement.java:185)
at org.mariadb.jdbc.MariaDbClientPreparedStatement.execute(MariaDbClientPreparedStatement.java:129)
at com.placeoweb.TestSqlMariadbMysql.main(TestSqlMariadbMysql.java:108)
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: You need to set exactly 1 parameters on the prepared statement
Query is : INSERT INTO my_table (my_col) VALUES ('my_val')null
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQueries(AbstractQueryProtocol.java:698)
at org.mariadb.jdbc.MariaDbClientPreparedStatement.executeInternal(MariaDbClientPreparedStatement.java:177)
... 2 more
And for insert multiple rows insert statement INSERT INTO my_table (my_col) VALUES ('my_val1'),('my_val2')
, failed also :
Exception in thread "main" java.sql.SQLException: You need to set exactly 1 parameters on the prepared statement
Query is : INSERT INTO my_table (my_col) VALUES ('my_val1')null,('my_val2')
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: You need to set exactly 1 parameters on the prepared statement
Query is : INSERT INTO my_table (my_col) VALUES ('my_val1')null,('my_val2')
Like the first case, CONJ is adding a "null" (only after the first values declaration), and broke the statement ! While the statement is working fine on the command line console.