title: Connecting to remote SQL Server using SQL Driver in Java
body: <p>Key notes:</p>
  
  <ul>
  <li>Using SQL Server 2005</li>
  <li>Using JDK 1.8</li>
  <li>JDK 1.8 DOES NOT SUPPORT JDBC-ODBC Bridge ANYMORE</li>
  <li>I have both Microsoft SQLJDBC 4.0 and 6.2 in my library</li>
  </ul>
  
  <p>I am trying to connect to a remote SQL Server in Java for quite some time now and still have not been able to. I am hoping to connect using my DSN that I have created. The new driver JDK 1.8 uses needs a connection URL which I have created below. Everything in the code below looks correct. But I am still getting the error:</p>
  
  <blockquote>
    <p>SEVERE: Java Runtime Environment (JRE) version 1.8 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
    java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.8 is not supported by this driver.<br>
    Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>String connectionUrl = "jdbc:sqlserver://InterfaceDSN" +  
      "databaseName=DB_Local;Trusted_Connection=True;integratedSecurity=true";  
  
      // Declare the JDBC objects.  
      Connection con = null;  
      Statement stmt = null;  
      ResultSet rs = null;  
  
      try 
      {
          Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");  
          con = DriverManager.getConnection(connectionUrl);  
  
          String SQL = "SELECT TOP 10 * FROM Person.Contact";  
          stmt = con.createStatement();  
          rs = stmt.executeQuery(SQL);
  
          while (rs.next()) {  
            System.out.println(rs.getString(4) + " " + rs.getString(6));  
          }  
      }catch (Exception e) 
      {  
          e.printStackTrace();  
      }
  </code></pre>
  
  <p>To conclude:
  Knowing what I have and what I need, is there another way to connect to the database, I am running out of options here considering I am using JDK 1.8 with SQL Server 2005.</p>