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

[Enhancement]: Honoring MSSQL aditional properties on connection url #5728

Open
bsofiato opened this issue Aug 15, 2022 · 3 comments
Open

[Enhancement]: Honoring MSSQL aditional properties on connection url #5728

bsofiato opened this issue Aug 15, 2022 · 3 comments

Comments

@bsofiato
Copy link

Module

MSSQLServer

Proposal

Unlike the other database modules, the MSSQL module does not honor additional properties passed on the connection URL.

The culprit seems to be the 'parseUrl' method on the ConnectionUrl class. It expects the query parameters to be prefixed by the '?' character. However, in the MSSQL case, those parameters are preceded by the ';' character instead.

This is particularly troublesome when you use hibernate and the char/varchar datatypes. By default, the MSSQL driver uses Unicode encoding. This triggers full scans when querying by columns whose type is char/varchar. Eventually leading to deadlocks (I have a hunch that this issue is related to this).

I propose that we change the ConnectionUrl class to allow it to parse MSSQL URLs correctly. If you guys deem this change worthwhile, I can submit a PR for it.

@eddumelendez
Copy link
Member

@bsofiato thanks for raising the issue!

property (Optional) is one or more option connection properties. For more information, see Setting the connection properties. Any property from the list can be specified. Properties can only be delimited by using the semicolon (';'), and they can't be duplicated.

From the docs

Your PR is welcome, just would like to take into account managing backward compatibility.

@bsofiato
Copy link
Author

@eddumelendez Great, I should submit a working PR for that in a couple of days

@mmimica
Copy link

mmimica commented Nov 17, 2022

Combined with microsoft/mssql-jdbc#1958, it makes it impossible to pass parameters any other way as even the following doesn't work:

HikariDataSource(HikariConfig().apply {
                jdbcUrl = "jdbc:tc:sqlserver:2019-latest:///"
                driverClassName = ContainerDatabaseDriver::class.qualifiedName
                dataSourceProperties = Properties().apply {
                    this["disableStatementPooling"] = "false"
                    this["statementPoolingCacheSize"] = "50"
                    this["sendStringParametersAsUnicode"] = "false"
                    this["enablePrepareOnFirstPreparedStatementCall"] = "true"
                }
            })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants