title: Connect to sql server from java with jdbc(windows authentication mode)
body: <p>I need to connect to Sql Server 2008 from java using <a href="http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx" rel="nofollow noreferrer">jdbc 4.0</a>.
  I have a very simple code:</p>
  
  <pre><code> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
   String connectionUrl = "jdbc:sqlserver://localhost;" +
      "integratedSecurity=true;";
   Connection con = DriverManager.getConnection(connectionUrl);
  </code></pre>
  
  <p>But i have this error:</p>
  
  <pre><code>    Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
  at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
      at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241)
  ...
  </code></pre>
  
  <p>I follow this answer:<a href="https://stackoverflow.com/a/12524566/1554397">https://stackoverflow.com/a/12524566/1554397</a> </p>
  
  <p>I added jdbc4.jar in Libraries/Compile</p>
  
  <p>SQL Server Browser windows service is running.</p>
  
  <p>In SQL Server Network Configuration i selected Enebled on TCP/IP properties.</p>
  
  <p>I Set TCP Address to 1433.</p>
  
  <p>On Run,VM Options i put -Djava.library.path=my path to sqljdbc_auth.dll
  And copy in JDk ,in bin sqljdbc_auth.dll.</p>
  
  <p>What should I do?</p>
  
  <p><strong>EDIT:</strong>
  When write in cmd <em>telnet localhost 1433</em> i get 'Could not open connection to the host,on port 1433'</p>