title: Microsoft SQL Server: "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."
body: <p>I tried to connect to Microsoft SQL Server and it gives me the error <code>Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. ClientConnectionId:f5448d0d-950a-45b3-842f-9d2c6ac86ccd</code></p>
  
  <p>When I run <code>netstat -na</code> and I found a listening with a port of 1433 but still, the connection with Java doesn't work.</p>
  
  <p>My code:</p>
  
  <pre><code>Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  
  connnectionUrl = "jdbc:sqlserver://localhost:1434;database=Northwind;integratedSecurity=true;";
  
  con = DriverManager.getConnection(connnectionUrl);
  </code></pre>
  
  <p>Full stacktrace:</p>
  
  <pre><code>   com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. ClientConnectionId:f5448d0d-950a-45b3-842f-9d2c6ac86ccd
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:254)
      at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:258)
      at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:104)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4772)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3581)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:81)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3541)
      at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2395)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2042)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1889)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1120)
      at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:700)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at jdbc.Temp.main(Temp.java:18)
  </code></pre>