When you use JDBC driver to set up an application connection string to MS SQL Server database, it passed the sendStringParametersAsUnicode parameter as True if you don't define sendStringParametersAsUnicode in the connection string specifically. The default value is True. It will cause high CPU usage on SQL Server due to implicit conversion in queries passed from the application. The default setting send all the parameters in the queries as nvarchar.
If the data type in the tables does not align with the parameters datatype declared in the application queries, it will cause implicit conversion and table scan.
We need to always set sendStringParametersAsUnicode = False in JDBC connection string to SQL server database.
JDBC URL —
url="jdbc:sqlserver://
host:port;databaseName=dbName;SelectMethod=cursor;SendStringParametersAsUnicode=false"
Thank you for reading my post.
No comments:
Post a Comment