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.
Configuring SQuirrel SQL Client.

Configuring SQuirrel SQL Client.

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!!!!

15 thoughts on “Squirrel SQL, jTDS and Windows Authentication (SSO) for Microsoft SQL Server

  1. CSW

    I followed your directions, but am getting the error “The user is not associated with a trusted SQL Server connection.” But I can log in using Windows authentication with WinSQL.

    Can you offer any suggestions? thanks

     
    Reply
    1. Karthic Raghupathi

      You may be getting this error due to one of the following reasons:
      – You have a typo in your username.
      – You are trying to connect to a SQL Server database with a SQL Server login.
      – You are trying to connect to a SQL Server database from a Windows account that does not have sufficient permissions to connect to the server.

      If it is the second or third reason, you’ll have to reach out to you SQL admin / DBA to get the issue resolved.

       
      Reply
  2. Sameer Nafdey

    Your post was useful but wondering why you did not mentioned the element in the URL

    jdbc:jtds:sqlserver://your.server.or.ip.address.com/;domain=YOURDOMAIN;

    Regards,
    Sameer

     
    Reply
  3. Sameer Nafdey

    should be mentioned as ..

    jdbc:jtds:sqlserver://your.server.or.ip.address.com/databaseName;domain=YOURDOMAIN;

     
    Reply
  4. Pingback: cannot connect to SQLServer in SquirrelSQL on mac | Solutions for enthusiast and professional programmers

  5. Rusty

    Thanks for the instructions!

    FYI, it looks like you don’t actually have to add the DLL to the classpath. I removed it from the classpath and my connections still work.

     
    Reply
  6. Muhammad

    Very Very useful, after battling for so long – finally got mine working !!

    dhanewadh

     
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *