title: JTDS Connection problems to SQL Server - Works on 2000 but not 2005
body: <p>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.  </p>
  
  <p>The connection string specified is:  </p>
  
  <pre><code>String connectionString = _"jdbc:jtds:sqlserver://"+server+":"+port+"/"+database+";domain="+domain;_
  </code></pre>
  
  <p>and I am getting the connection via:  </p>
  
  <pre><code>con = java.sql.DriverManager.getConnection(url, _username, _password);
  </code></pre>
  
  <p>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:</p>
  
  <p><strong>java.sql.SQLException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.</strong></p>
  
  <p>Looks a bit funny to be because the user in the exception is blank, but the username specified in the parameter was not blank.</p>
  
  <p>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)</p>