You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jdbcModule: the JDBC driver (jdbc-v2; with legacy: the v1 driver)queriesArea: how the client builds and runs statements (parameters, quoting, batches)question
Why does the SQL in my XML file execute normally when inserted individually, but an error occurs when executed in batches, and the error code is -2, and I can't tell where the problem lies?
INSERT INTO mq_log.t_supply_available_hotel (
supplier_id,
sp_hotel_id,
check_in,
check_out,
search_date,
create_time
) values
(
#{item.supplierId},
#{item.spHotelId},
#{item.checkIn,jdbcType=DATE},
#{item.checkOut,jdbcType=DATE},
#{item.searchDate,jdbcType=DATE},
#{item.createTime,jdbcType=TIMESTAMP}
)
this is my xml
Good day, @ducklikeeat!
What version of the JDBC do you use?
what library version do you use?
what framework do you use?
would you please share a sample code to understand how XML gets into a statement?
I think this is because we do not support constructions like #{item.checkIn,jdbcType=DATE} in the V2 JDBC because they are not defined in the spec.
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!
Recommendation: Close — no response
The reporter did not answer the request of 2025-05-16 for the driver version, the framework, and the code. Without the error text, the cause of the -2 is not known.
Status on main: Not applicable — at 8480ca001, ClickHouse 26.11.4.11, the statement that MyBatis makes from the issue's XML for two items (two rows of ? markers, one addBatch()) stores both rows, and executeBatch() returns [2].
Breaking change: No
Duplicates / related: None found
Analysis: MyBatis replaces each #{…}, also with jdbcType=DATE, with a ? marker before it calls the driver, so the driver does not see that syntax. -2 is the value of Statement.SUCCESS_NO_INFO: jdbc-v2 returns it from executeBatch() when the row count of the server differs from the number of batch entries (jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java:378-382). The issue does not say if the -2 is such a return value or the code of an exception.
Automated triage by Polyglot AI. A maintainer makes the final decision.
jdbcModule: the JDBC driver (jdbc-v2; with legacy: the v1 driver)queriesArea: how the client builds and runs statements (parameters, quoting, batches)question
Activity
ducklikeeat commentedon May 16, 2025
chernser commentedon May 16, 2025
Good day, @ducklikeeat!
What version of the JDBC do you use?
what library version do you use?
what framework do you use?
would you please share a sample code to understand how XML gets into a statement?
I think this is because we do not support constructions like
#{item.checkIn,jdbcType=DATE}in the V2 JDBC because they are not defined in the spec.Thanks!
github-actions commentedon Jul 13, 2026
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!
polyglotAI-bot commentedon Nov 28, 2026
Recommendation: Close — no response
The reporter did not answer the request of 2025-05-16 for the driver version, the framework, and the code. Without the error text, the cause of the
-2is not known.main: Not applicable — at8480ca001, ClickHouse 26.11.4.11, the statement that MyBatis makes from the issue's XML for two items (two rows of?markers, oneaddBatch()) stores both rows, andexecuteBatch()returns[2].Analysis: MyBatis replaces each
#{…}, also withjdbcType=DATE, with a?marker before it calls the driver, so the driver does not see that syntax.-2is the value ofStatement.SUCCESS_NO_INFO: jdbc-v2 returns it fromexecuteBatch()when the row count of the server differs from the number of batch entries (jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java:378-382). The issue does not say if the-2is such a return value or the code of an exception.Automated triage by Polyglot AI. A maintainer makes the final decision.