JDBC v1.1 CTP Using Type 2 Integrated Security

To use the Type 2 Integrated Security feature with the v1.1 CTP (if you don't have this already make sure to get it! see my previous blog) you only need to make sure that the Windows authentication DLL is visible to the application that is going to use it (This usually means it is in the same directory or in a directory specified in your Path). Then specify integratedSecurity in your connection string and you are done.

The Windows authentication DLL is located under:

\sqljdbc_1.1\enu\auth\x86\sqljdbc_auth.dll  //for x86 client OS versions
\sqljdbc_1.1\enu\auth\x64\sqljdbc_auth.dll  //for AMD 64 clients running Windows 2003 64bit OS  

import java.sql.*;

public class test {
 public static void main(String[] args) {
  try {
   java.lang.Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
   Connection conn = java.sql.DriverManager.getConnection("jdbc:sqlserver://servername;integratedSecurity=true");
   System.out.println("Connected!");
   conn.close();

  } catch (Exception ex) {
   ex.printStackTrace();
  }
 }
}