Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Driver returns SQL State longer than 5 characters #956

Closed
axelfontaine opened this issue Feb 8, 2019 · 2 comments · Fixed by #977
Closed

[BUG] Driver returns SQL State longer than 5 characters #956

axelfontaine opened this issue Feb 8, 2019 · 2 comments · Fixed by #977
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects

Comments

@axelfontaine
Copy link

Driver version

7.2.1

SQL Server version

N/A

Client Operating System

N/A

JAVA/JVM version

1.8, 11

Table schema

N/A

Problem description

  1. Expected behaviour: when an error occurs the driver should throw a SQL exception with a 5 character SQL state
  2. Actual behaviour: SQL state is sometimes 6 characters due to this code: https://github.com/Microsoft/mssql-jdbc/blob/9c5cc97f661fe14de11df6be16c8acbc3379d1ff/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java#L364

The EXECUTE AS USER = 'DOMAIN/USER' can for example result in SQL state S00011 (6 chars!) and the message Could not obtain information about Windows NT group/user '[USER_NAME]', error code 0x4bc.

This was reported to us by a customer: See flyway/flyway#2275

We believe the driver's behavior is incorrect in this case as it violates the SQLSTATE standard.

@axelfontaine axelfontaine added the Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. label Feb 8, 2019
@cheenamalhotra
Copy link
Member

Hi @axelfontaine

We will investigate on this and get back to you soon!

@cheenamalhotra
Copy link
Member

Hi @axelfontaine

I created PR #977 to fix this non-compliance. Let me know if you have any more concerns.

@cheenamalhotra cheenamalhotra moved this from Under Investigation to Waiting for Customer in MSSQL JDBC Mar 8, 2019
MSSQL JDBC automation moved this from Waiting for Customer to Closed Issues Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
MSSQL JDBC
  
Closed Issues
Development

Successfully merging a pull request may close this issue.

2 participants