@@ -2193,7 +2193,7 @@ public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQL
21932193 }
21942194
21952195 SQLServerBulkBatchInsertRecord batchRecord = new SQLServerBulkBatchInsertRecord (
2196- batchParamValues , bcOperationColumnList , bcOperationValueList , null , connection . getDatabaseCollation (). getIsCaseSensitive ());
2196+ batchParamValues , bcOperationColumnList , bcOperationValueList , null , isDBColationCaseSensitive ());
21972197
21982198 for (int i = 1 ; i <= rs .getColumnCount (); i ++) {
21992199 Column c = rs .getColumn (i );
@@ -2211,15 +2211,15 @@ public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQL
22112211 }
22122212 if (null != bcOperationColumnList && !bcOperationColumnList .isEmpty ()) {
22132213 // connection contains database name
2214- boolean isCaseSensitive = connection . getDatabaseCollation (). getIsCaseSensitive ();
2215- int columnIndex ;
2214+ boolean isCaseSensitive = isDBColationCaseSensitive ();
2215+ int columnIndex = - 1 ;
22162216 if (isCaseSensitive ) {
22172217 columnIndex = bcOperationColumnList .indexOf (c .getColumnName ());
22182218 } else {
22192219 // find index ignore case
2220- columnIndex = -1 ;
22212220 for (int opi = 0 ; opi < bcOperationColumnList .size (); opi ++) {
2222- if (bcOperationColumnList .get (opi ).equalsIgnoreCase (c .getColumnName ())) {
2221+ String opCol = bcOperationColumnList .get (opi );
2222+ if (opCol != null && opCol .equalsIgnoreCase (c .getColumnName ())) {
22232223 columnIndex = opi ;
22242224 break ;
22252225 }
@@ -2401,7 +2401,7 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio
24012401 }
24022402
24032403 SQLServerBulkBatchInsertRecord batchRecord = new SQLServerBulkBatchInsertRecord (
2404- batchParamValues , bcOperationColumnList , bcOperationValueList , null , connection . getDatabaseCollation (). getIsCaseSensitive ());
2404+ batchParamValues , bcOperationColumnList , bcOperationValueList , null , isDBColationCaseSensitive ());
24052405
24062406 for (int i = 1 ; i <= rs .getColumnCount (); i ++) {
24072407 Column c = rs .getColumn (i );
@@ -2493,6 +2493,12 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio
24932493 }
24942494 }
24952495
2496+ private boolean isDBColationCaseSensitive () throws SQLServerException {
2497+ if (null == connection .getDatabaseCollation ())
2498+ return false ;
2499+ return connection .getDatabaseCollation ().getIsCaseSensitive ();
2500+ }
2501+
24962502 private void checkValidColumns (TypeInfo ti ) throws SQLServerException {
24972503 int jdbctype = ti .getSSType ().getJDBCType ().getIntValue ();
24982504 String typeName ;
0 commit comments