SQLServerException provides null SQLState and 0 error code #2015
Labels
Bug
A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
Milestone
Driver version
12.1.0.jre11-preview
SQL Server version
Microsoft SQL Server 2022 (RC1) - 16.0.950.9 (X64)
Client Operating System
Windows 10
JAVA/JVM version
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
Table schema
N/A
Problem description
SQLExceptions thrown by the 12.1.0 preview driver no longer include valid SQLState or error code values. This appears to be a significant regression since many applications rely on these values for proper exception handling. We happen to use Spring SQLExceptionTranslators to translate SQLExceptions into standard Spring runtime exceptions (DataIntegrityViolationException and DeadlockLoserDataAccessException in the below examples) and the translations are now failing because these return values are incorrect.
A couple examples that our test suite flagged are provided below, but this is likely not an exhaustive list.
Expected behavior
In previous versions (11.2.1, 10.2.1), calling getSQLState() returned a valid SQL state code and getErrorCode() returned a valid vendor code. Two examples:
Actual behavior
With the preview driver, the above exceptions no longer provide valid values. In both cases:
Let me know if you need more information to resolve this.
The text was updated successfully, but these errors were encountered: