Wednesday, May 28, 2014

Connect to SQL Server in SQL Workbench Using Integrated Windows Authentication

Just a quick note to anyone may be looking for the steps:
  1. Download Microsoft JDBC driver package from here (download the tarball package) 
  2. Unzip the package and copy sqljdbc_auth.dll simply to system32 folder or any location defined in PATH
  3. Copy sqljdbc4.jar to any location 
  4. Setup SQL Server jdbc driver in SQL Workbench, point the jar to the sqljdbc4.jar 
  5. Create a new connection using the sample URL
    jdbc:sqlserver://[hostname]:[port];integratedSecurity=true;databaseName=[database_name];  
Note: integratedSecurity=true means using windows integrated authentication The jdbc driver will try to load the sqljdbc_auth.dll in order to authenitcate the user. No username and password is reqired in connection profile as it uses windows login user.