Conversation
Removed the semicolon from the SQL query as it caused a syntax error . ( Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;columnA, SOURCE.columnB);END-OF-STATEMENT, DRIVER=4.26.14 )
|
Thanks for the improvement @andyphone |
|
@andyphone are in a position to add tests for this, if not I could take this on. |
|
@davidradl I'm not very familiar with the unit testing process on Git, so I'd really appreciate it if you could take care of this. Thanks! |
RocMarshal
left a comment
There was a problem hiding this comment.
Thanks @andyphone for the pr and @eskabetxe @davidradl for the review.
@davidradl May I know the latest new progress about adding unit test cases for the pr?
|
This PR is being marked as stale since it has not had any activity in the last 90 days. If you are having difficulty finding a reviewer, please reach out to the If this PR is no longer valid or desired, please feel free to close it. |
### Motivation The SQL generated by `Db2Dialect#getUpsertStatement` previously ended with a trailing semicolon (`;`). When executing the generated statement through the DB2 JDBC driver, the trailing semicolon may cause a syntax error. In particular, when the target table contains a primary key, the driver may throw the following exception: ``` com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601 ``` This happens because DB2 JDBC does not expect a semicolon at the end of a SQL statement executed through `PreparedStatement`. ### Changes This PR removes the trailing semicolon from the SQL statement generated by `Db2Dialect#getUpsertStatement`. As a result, the generated `MERGE INTO` statement can be executed correctly by the DB2 JDBC driver. ### Tests The existing `Db2DialectTest#testUpsertStatement` test has been updated to reflect the corrected SQL format (without the trailing semicolon). This ensures that a trailing semicolon will not be reintroduced in future changes. ### Impact This change only affects the SQL formatting of the DB2 dialect and does not affect other JDBC dialect implementations.
|
@davidradl plz have a look am i wrong |
|
I've added the test update and adjusted the expected SQL accordingly. |
|
Hi, @andyphone Thanks for the update. |
Removed the semicolon from the SQL query as it caused a syntax error . ( Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;columnA, SOURCE.columnB);END-OF-STATEMENT, DRIVER=4.26.14 ) This error only occurs when a primary key is defined in the table structure.