-
Notifications
You must be signed in to change notification settings - Fork 453
Description
Driver version
13.2.1.jre11
SQL Server version
Microsoft SQL Server 2022 (RTM-CU21-GDR) (KB5068406) - 16.0.4222.2 (X64)
Client Operating System
Linux
JAVA/JVM version
Java 21
Table schema
create table DB1.contract.pre_focus_ergebnis (
id bigint primary key not null,
creationDateTime datetime2 not null,
source char not null,
focAenderungArt char,
focAusbezahlterBetrag decimal(13,2),
focAuszahlungsweg char,
focBuchungsmonat decimal(6),
focErbrachteLeistungenVertrag decimal(13,2),
focFehlerPreBerechnung char(5),
focGruppenNummer decimal(9),
focIsPre bit,
focJahr decimal(4),
focLandesdirektion smallint,
focLaufNr decimal(3),
focLaufendeNummerVp decimal(4),
focLeistungsBetrag decimal(13,2),
focModell char,
focOrdnungsbegriffwechselVorhanden decimal(1),
focPersonenArt decimal(3),
focPersonenVariante char,
focPersonennummer decimal(8),
focPersonennummerPraemienzahler decimal(8),
focPolizzenNummer decimal(10) not null,
focPreArt char,
focProzentsatz decimal(4,1),
focReferentUserId varchar(8),
focRisikogemeinschaft char,
focRisikogemeinschaftTarifgruppe char,
focSperrvermerk char(5),
focStufe decimal(1),
focTarif decimal(10),
focTarpos decimal(3),
focTarspa decimal(3),
focWaehrungsCode char(3)
);
GO
Problem description
If i execute a batch insert through hibernate JPA i get the following error:
"Received an invalid column length from the bcp client for colid 1."
The physical column with colid 1 in the database is the "id" as expected. In the model that is also declared as the first field in the entity (with matching column annotation declaring it as ID and bigint not-null).
I enabled FINE logs to see more details, but could not really find the root cause:
2025-12-01 14:52:05,310 [ex# ] FINE [SQLServerStatement ] sp_executesql SQL: null created by (ConnectionID:5 ClientConnectionId: 4a57d5a2-0cdd-4206-a62f-30dfd0f2468a)
2025-12-01 14:52:05,323 [ex# ] FINE [SQLServerStatement ] SQLServerStatement:105 created by (ConnectionID:5 ClientConnectionId: 4a57d5a2-0cdd-4206-a62f-30dfd0f2468a)
2025-12-01 14:52:05,324 [ex# ] FINE [SQLServerStatement ] SQLServerStatement:105 Executing (not server cursor) sp_executesql N'SET FMTONLY ON SELECT * FROM contract.pre_focus_ergebnis '
2025-12-01 14:52:05,327 [ex# ] FINE [SQLServerResultSet ] SQLServerResultSet:72 created by (SQLServerStatement:105)
2025-12-01 14:52:05,337 [ex# ] FINE [SQLServerResultSetMetaData] SQLServerResultSetMetaData:2 created by (SQLServerResultSet:72)
2025-12-01 14:52:05,338 [ex# ] FINE [SQLServerStatement ] SQLServerStatement:106 created by (ConnectionID:5 ClientConnectionId: 4a57d5a2-0cdd-4206-a62f-30dfd0f2468a)
2025-12-01 14:52:05,338 [ex# ] FINE [SQLServerStatement ] SQLServerStatement:106 Executing (not server cursor) select collation_name, is_computed, encryption_type from sys.columns where object_id=OBJECT_ID('contract.pre_focus_ergebnis') order by column_id ASC
2025-12-01 14:52:05,343 [ex# ] FINE [SQLServerResultSet ] SQLServerResultSet:73 created by (SQLServerStatement:106)
2025-12-01 14:52:05,372 [ex# ] FINE [SQLServerException ] *** SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Received an invalid column length from the bcp client for colid 1. Msg 4815, Level 17, State 1, Received an invalid column length from the bcp client for colid 1.
2025-12-01 14:52:05,375 [ex# ] INFO [batch ] HHH100503: On release of batch it still contained JDBC statements
2025-12-01 14:52:05,376 [ex# ] WARN [SqlExceptionHelper ] SQL Error: 0, SQLState: null
2025-12-01 14:52:05,376 [ex# ] ERROR [SqlExceptionHelper ] Received an invalid column length from the bcp client for colid 1.
2025-12-01 14:52:05,385 [ex# ] WARN [arjuna ] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff64610141:b31b:692d9d77:1f, org.hibernate.resource.transaction.backend.jta.internal.synchronization.RegisteredSynchronization@1f341035 >: org.hibernate.exception.GenericJDBCException: could not execute batch [Received an invalid column length from the bcp client for colid 1.] [insert into contract.pre_focus_ergebnis (creationDateTime,focAenderungArt,focAusbezahlterBetrag,focAuszahlungsweg,focBuchungsmonat,focErbrachteLeistungenVertrag,focFehlerPreBerechnung,focGruppenNummer,focIsPre,focJahr,focLandesdirektion,focLaufNr,focLaufendeNummerVp,focLeistungsBetrag,focModell,focOrdnungsbegriffwechselVorhanden,focPersonenArt,focPersonenVariante,focPersonennummer,focPersonennummerPraemienzahler,focPolizzenNummer,focPreArt,focProzentsatz,focReferentUserId,focRisikogemeinschaft,focRisikogemeinschaftTarifgruppe,focSperrvermerk,focStufe,focTarif,focTarpos,focTarspa,focWaehrungsCode,source,id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]
Expected behavior
The insert is executed as bulk insert in the DB.
Actual behavior
Error.
Error message/stack trace
See description
Any other details that can be helpful
My best guess is the column mapping which might be wrong for some reason, but i am lacking the insight on what exactly goes wrong and how i could debug further.