Typical Issues
- Symptom: When preparedStatement binds parameters multiple times, the following error occurs during batch insertion:
java.lang.RuntimeException: java.sql.BatchUpdateException: Batch entry 0 - 5 insert into test_batch1(v1,v2) values(('1'),('value2_0')) was aborted: [*.*.*.*:*/*.*.*.*:*] ERROR: invalid input syntax for integer: "ss" Call getNextException to see other errors in the batch.
Cause: The data type of a bound parameter differs from the initially bound parameter.
Solution: To ensure successful batch insertion using preparedStatement, maintain consistency in the data types of bound parameters.
- Symptom: The array of results returned by preparedStatement after batch insertion does not match the results returned by Oracle Database.
Cause: When batchMode is set to on, JDBC utilizes GaussDB's distinct packet processing logic, which differs from Oracle Database's logic but offers faster speed. Setting batchMode to off in the connection string will ensure consistency with Oracle Database's results.
When batchMode is set to on, Complete Example will produce results that differ from those generated by Oracle Database's corresponding API.[5, 0, 0, 0, 0]
Oracle Database's results:[1, 1, 1, 1, 1]
When batchMode is set to off, the results become consistent with Oracle Database's corresponding API.
[1, 1, 1, 1, 1]
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot