PreparedStatement.executeBatch() Throws BatchUpdateException "Unable to retrieve column metadata." When Insert SQL Column Name Case Does Not Match Table#2695
Merged
muskan124947 merged 12 commits intomainfrom Jun 26, 2025
Conversation
- Add test case for matching column case in batch execution - Add test case for mismatched column case in batch execution, expected SQLServerException
- Update column index search to be case-insensitive in SQLServerPreparedStatement - Remove failing test case in BatchExecutionTest that was checking for specific exception
- Add getIsCaseSensitive() method to SQLCollation class - Update SQLServerPreparedStatement to use case sensitivity information - Improve performance by avoiding unnecessary case-insensitive comparisons
- Add support for case-sensitive column names in SQLServerBulkBatchInsertRecord - Update SQLServerBulkRecord to handle case sensitivity in column metadata - Modify SQLServerPreparedStatement to pass case sensitivity information to batch records - Add tests for case-sensitive and case-insensitive column name handling in batch execution
…port in BatchExecutionTest
…abase in unit test.
- Return false (case-insensitive) if sortOrder is not found
machavan
previously approved these changes
Jun 25, 2025
Ananya2
previously approved these changes
Jun 25, 2025
divang
reviewed
Jun 25, 2025
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2695 +/- ##
============================================
+ Coverage 51.67% 51.89% +0.21%
- Complexity 4011 4054 +43
============================================
Files 147 147
Lines 33759 33828 +69
Branches 5640 5655 +15
============================================
+ Hits 17445 17554 +109
+ Misses 13861 13820 -41
- Partials 2453 2454 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
divang
approved these changes
Jun 25, 2025
machavan
approved these changes
Jun 25, 2025
David-Engel
approved these changes
Jun 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Description
When using executeBatch() to insert data, if the names of the columns in SQL statement do not match the case (uppercase/lowercase) of the actual column names in the database, the driver throws a BatchUpdateException with the message "Unable to retrieve column metadata."
GitHub Issue : [BUG] PreparedStatement.executeBatch() When the Insert Sql Column Name Case Mismatch, Throws BatchUpdateException "Unable to retrieve column metadata."
Note: This PR incorporates the community-contributed changes from PR: #2589.