Squirrel SQL, jTDS and Windows Authentication (SSO) for Microsoft SQL Server

If you are like me and you hate spinning up a virtual machine every time you need to run a few simple queries in MS SQL Server, you have reached the right place. Read on to find out how to setup up SQuirreL (a universal SQL client) to connect to MS SQL Server via Windows Authentication (SSO). The great thing is this process will work on a Mac and Windows machine as well if you’d like to keep things consistent and use a single tool across platforms to accomplish tasks.

The key point to note here is, unlike other posts on the web that have you add the dll file in some PATH or similar environment variable in the system, I show you how to add it within SQuirreL SQL. I like this approach as it keeps things clean and self contained and not to mention that is very easy to memorize and replicate in other machines and on other OSes.

Pre-Requisites:

Setting up the driver in SQuirreL:

  • Open up SQuirreL SQL Client and select Drivers on the left to pull up the drivers list
  • Scroll down to jTDS Microsoft SQL and select it. Then click Modify the Selected Driver at the top. The icon looks like a pen or a pencil for this function.
  • In the modal window that pops up, select the Extra Class Path tab.
  • Click Add and navigate to the folder where you have downloaded the jTDS-version.jar file. Select OK to add it to the list.
  • Click Add again and navigate to the folder where you have ntlmauth.dll downloaded to. Ensure you select the driver for the appropriate architecture (x86, x64, or ia64).
  • Here is a picture for some easy reference.

Screenshot of configuring SquirrelSQL

Setting up the connection:

  • Select Aliases on the left to pull up the aliases list.
  • Click Create a new Alias at the top. The icon looks like a thick plus symbol for this function.
  • In the modal window that pops up, give the connection a name.
  • Select jTDS Microsoft SQL in the Driver drop down list.
  • Enter your URL in the following format:
    • jdbc:jtds:sqlserver://your.server.or.ip.address.com/;domain=YOURDOMAIN;
  • Use your domain credentials for username and password and hit OK to save the connection

Now double click on the newly created connection and hit connect to log on.

Happy coding!!!!