How to make use of Trusted_connection property with jTDS driver?

1.8k views Asked by At

I am using jTDS driver to connect to a SQL Server database. I don't want to provide my Windows Domain username and password but would like to make use of Trusted_connection property in my connection string. However it seems as per this jTDS driver FAQ page there is no property named Trusted_connection supported by jTDS driver.

Given the application and SQL Server database are on the same host and I have ntlmauth.dll installed correctly, how do I take advantage of Trusted_connection property so that I don't have to specify username/password?

Is it that jTDS automatically makes use of Domain username and password as soon as it spots useNTLMv2 and domain properties being used as shown in the following connection url?

jdbc:jtds:sqlserver://DBHostName:Port/DatabaseName;useNTLMv2=true;domain=DomainName

NB: I could test this myself if only I have access to the code of the application.

1

There are 1 answers

2
flup On BEST ANSWER

As described in the file README.SSO, you need not specify any credentials.

In order to set up the jTDS driver to use Windows Single Sign On, users will have to connect without providing a user name and password. This will only work on Windows.

Driver example:

    // No user name or password in URL or as parameters
    DriverManager.getConnection(
            "jdbc:jtds:sqlserver://localhost:1433/LionKing");

You need not specify the useNTLMv2 parameter either, if you do it determines the version of NTLM that will be used, not IF NTLM will be used or not.