Skip to content

[BUG]loginTimeout in URL not valid if DriverManager.setLoginTimeout #1048

@slggamerTrue

Description

@slggamerTrue

Driver version

6.2.2

SQL Server version

Any

Client Operating System

Linux or Mac or Windows

JAVA/JVM version

1.8

Table schema

No need

Problem description

When I set logintimeout in URL, I expect that the connection would timeout by the setting in URL. But it would timeout by the global loginTimeout setting.

And the problem is caused by the loginTimeout property is overwritten in SQLServerDriver.parseAndMergeProperties
image

Reproduction code

With the following code, the connection would timeout in 60 seconds not 5 seconds.
DriverManager.setLoginTimeout(60)
println(new Date().toString())
try {
url = "jdbc:sqlserver://10.0.2.15;userName=sa;password=PASSW0RD;database=master;socketTimeout=10000;logintimeout=5"
def sql = Sql.newInstance(url, "system", "123456", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
}
catch (Exception e) {
println(e.getMessage())
println(new Date().toString())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in the driver. A high priority item that one can expect to be addressed quickly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions