title: Error while connecting to Microsoft SQL Server
body: <p>I am trying to connect to MS SQL Server 2005 from java, I am getting the following error,
  can anyone help me ?</p>
  
  <pre><code>private static final String DRIVER_CLASS = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; 
  Class.forName(DRIVER_CLASS); 
  DriverManager.getConnection("jdbc:sqlserver://localhost:1433","sa","root");
  </code></pre>
  
  <p>I added the following 5 jar files :</p>
  
  <ul>
  <li>msbase</li>
  <li>mssqlserver</li>
  <li>msutil</li>
  <li>sqljdbc</li>
  <li>sqljdbc4</li>
  </ul>
  
  <p>The exception is :</p>
  
  <pre><code>java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
   at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
   at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
   at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
   at com.microsoft.jdbc.sqlserver.tds.TDSConnection.&lt;init&gt;(Unknown Source)
   at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
   at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
   at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
   at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
  </code></pre>