-
Notifications
You must be signed in to change notification settings - Fork 427
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
SqlTimeoutException expected: Got SQLServerException #634
Comments
Hi @eivinhb , Thank you for creating the issue, it is indeed a deficiency in the driver. We will address the issue in one of the upcoming preview releases. |
Looking av the code it seems to work fine. As a note, I would be scared to use string-equals check to identify the cause. Where the string originates from there is a //TODO where localisation is wanted to be added. So if the message is changed, the functionality also brakes. But this is not for me to address. Anyway, I am now not able to compile the dev-branch with java 8 since the classes, like |
Hi @eivinhb, the driver needs to be compiled with Java 9. You can compile a Java 8 jar by adding -Pbuild42 to your maven build commands, but Java 9 will still be used for the compilation. E.g. As for the localization issues, the string we use is an error message that gets localized in other languages of the driver, so there shouldn't be any problems as long as the resources are changed. |
Fixed in PR #641. |
Driver version or jar name
6.2.2.jre8
SQL Server version
SQL Server 2014 (Not important)
Client operating system
MacOS
Java/JVM version
1.8.0_121 (Not important)
Table schema
NA
Problem description
The java Statement-interface says:
But mssql-jdbc throws a
com.microsoft.sqlserver.jdbc.SQLServerException: The query has timed out.
instead. I think this is an old issue, since the non open source version also has this incorrect implementation of the api. I have looked at the code, and it is a tiny bit complicated to find a solution since the IOBuffer that is now throwing this exception has no idea for the cause, it only knows that the command is interrupted.I understand that this i an API change for the driver. But catching an exception and reading the text in the message to find out if we have a timing issue is is not a good practice.
Expected behavior and actual behavior
Should do what the java API has as a documented behaviour and throw a
java.sql.SQLTimeoutException
when statement setQueryTimeout is set.Repro code
I was inspired by #525 and made this:
The text was updated successfully, but these errors were encountered: