views:

65

answers:

1

I've been trying to get a java application connecting via the jtds jdbc to a couple of SQL servers. I have to connect via windows authentication.

The connection string specified is:

String connectionString = _"jdbc:jtds:sqlserver://"+server+":"+port+"/"+database+";domain="+domain;_

and I am getting the connection via:

con = java.sql.DriverManager.getConnection(url, _username, _password);

This works fine on my SQL Server 2000 but not on the SQL Server 2005. On my SQL Server 2005, I get the following error message:

java.sql.SQLException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Looks a bit funny to be because the user in the exception is blank, but the username specified in the parameter was not blank.

I have a feeling it might be something to do with NTLM and Windows authentication because it works when I try to log using SQL authentication (ie.without the domain property)

A: 

I have exactly the same problem - would love to know if you fixed it. I'm running from Linux, so can't use SSO instead.

Damian
Yup i fixed it by explicitly declaring in my connection string that i am authenticating by NTLM http://jtds.sourceforge.net/faq.html. In the connection string, put in useNTLMv2=true
Redcomet