问题
When calling some specific stored procedures using mssql-jdbc
, I get an jdbc internal error in Java:
Jan 02, 2020 8:11:32 AM com.microsoft.sqlserver.jdbc.TDSParser throwUnexpectedTokenException
SCHWERWIEGEND: ConnectionID:5 ClientConnectionId: 30dcbc6e-ec5c-45ba-8801-1ecc549a0cd4: getNextResult: Encountered unexpected unknown token (0xA3)
Jan 02, 2020 8:11:32 AM com.microsoft.sqlserver.jdbc.TDSReader throwInvalidTDSToken
SCHWERWIEGEND: ConnectionID:5 ClientConnectionId: 30dcbc6e-ec5c-45ba-8801-1ecc549a0cd4 got unexpected value in TDS response at offset:0
It is reproducable for those procedures, here is one I reduced to still throw the error:
PROCEDURE [dbo].[GetAllData]
WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNER
AS BEGIN ATOMIC WITH ( TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N'English')
SELECT NULL AS testcol
RETURN 0
END
Before I updated to SQL Server 2019 I was using SQL Server 2016, where the procedures worked fine.
I am using:
- SQL Server 2019 (15.0.2070.41)
- mssql-jdbc 7.4.0.jre8, 7.4.1.jre8, 8.1.1.jre8-preview
- AdoptOpenJDK 8u222
I had the same problem in dotnet using the Microsoft.Data.SqlClient
which I could "fix" by using the old System.Data.SqlClient
library.
来源:https://stackoverflow.com/questions/59559872/tdsparser-encountered-unexpected-unknown-token-0xa3