-
Notifications
You must be signed in to change notification settings - Fork 424
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
SendStringParametersAsUnicode parameter not working #2144
Comments
Hi @SimonChou12138, First, can you confirm for us the driver version you are using? You write that you are using version 6.2.2, but I don't see this version listed as part of our releases (I see a 6.2.0 and a 6.2.1). Can you confirm for us that you are using the The Microsoft JDBC Driver for SQL Server? Next, you should do is look into upgrading the version of the driver you are using. Version 6.2.x is no longer supported, as per our support matrix. We recommend upgrading to the latest stable release 12.2.0, or, if possible, the latest preview release 12.3.1. If you are restricted to version 6.2.x, we'll make our best effort to help you debug this version, but there have been numerous improvements to the driver in the last 6 years, which may help in resolving your situation. Please confirm for us this is the correct driver, and whether you're able to update, and in the meantime we'll look into possible causes for the issue you are facing. |
I'm sorry I forgot to mention my verification of the driver version in issues. In fact, after tracking the source code without success, I considered whether it was a driver version problem and looked at the fix log in recent years, and did not find similar problems. At the same time, I also tried to upgrade the driver to 12.3.0.jre8-preview version, but unfortunately, the problem still appears. By the way, I can confirm that I am using the Microsoft JDBC driver for SQL Server. In mvnrepository, I can find 6.2.2. Jre8 version |
Hi @SimonChou12138, I'm a little confused reading through your post, so please correct me if I'm wrong, but the problem you're describing is as follows: The second query you posted ( |
Hi @Jeffery-Wasty , Perhaps my expression is not clear, which has caused you confusion. Actually my question is, in the same set url parameters |
Hi @SimonChou12138, Okay I think we understand the issue a bit better now, thank you. To help us, we need more details regarding the issue:
|
Thank you for the extra information and the repro code. I still can't say for sure what the problem is, but my best guess is this. Using To have consistency between these tables, you should be using |
Hi @SimonChou12138, I've tried once again to replicate your results, and still can't. My suggestion at this time is to remove anything from your setup besides the driver and SQL Server and attempt that way. I'll continue to look into this on my end. |
Hi @SimonChou12138, Please try testing once more with a more recent version of SQL Server (2019 would be best) along with a recent version of the driver (12.3.1 would be best). My inability to replicate this might be because of the SQL Server version, and I am unable to use 2008. |
Hi @SimonChou12138, Without further update, we'll be closing this issue. Please let us know if you're able to test with a later version of SQL Server. |
Hi @SimonChou12138, Thank you for the reply. I'm retesting everything once more as it doesn't make sense to me why I can't reproduce the issue you're experiencing. One more bit of information that might help: what platform are you running on? Windows? Linux? |
In fact, in the context of the initial problem, the database was running on windows server and the program connecting to the SQL was running on Linux. |
Hi @SimonChou12138, I can now reproduce the issue, thank you. Will update you on any potential causes I find. |
I forgot to update this issue. I was mistaken, I'm still not able to accurately reproduce your issue. I was getting similar time differences, but it was for both |
@SimonChou12138 @Jeffery-Wasty |
Hi @CheneyYin, Thanks for your reply. This issue is backlogged for the moment. We'll look into your suggestion in greater detail when this gets picked up again. |
SendStringParametersAsUnicode attribute is set to "false" after the JDBC use prepareStatement SQL execution CHAR type query still very slowly
Based on SqlServer2008, the JDBC driver version is 6.2.2.jre8
Through a series of validation, in fact, in a single primary key OR query, actual sendStringParametersAsUnicode attribute is set to "false" is to take effect.
For example, the following SQL precompiled can take effect, The speed is normal.
Note that the ID here is of the char type, and this SQL will be slow before the property is configured
SELECT * FROM FS_InpatientContact WHERE ([ID]=?) OR ([ID]=?) OR ([ID]=?) OR ([ID]=?) OR ([ID]=?)......
However, this property seems to be invalid in another table query, where ITEM_CODE is of type char and REP_NO is of type numeric. Therefore, I speculate that it may have failed in the case of multiple primary keys.
SELECT * FROM AS_REPENTRY WHERE ([ITEM_CODE]=? AND [REP_NO]=?) OR ([ITEM_CODE]=? AND [REP_NO]=?) OR ([ITEM_CODE]=? AND [REP_NO]=?)......
With this in mind I Debug the source code
Through the debug source setObject method, which can be found in fact sendStringParametersAsUnicode properties of false was effective. However, when actually sent to the server, it should still be in Unicode format, so the conversion will be time-consuming, resulting in extremely slow SQL queries.
This problem is more obvious in the larger the data volume of the table
Above is my investigation process, but also hope guys to give some advice
The text was updated successfully, but these errors were encountered: