The GitHub Actions job "Flink Connector JDBC CI Backwards Compatibility" on 
flink-connector-jdbc.git/fixDB2bug has failed.
Run started by GitHub user andyphone (triggered by RocMarshal).

Head commit for run:
64a5e2e13b370caadc9c7bade14bc4c8b13b1839 / andyphone <[email protected]>
Update Db2PreparedStatementTest.java

### 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.

Report URL: 
https://github.com/apache/flink-connector-jdbc/actions/runs/22941367429

With regards,
GitHub Actions via GitBox

Reply via email to