how to connect to SQL Server with SQuirreL SQL from non domain registered Linux box?

77,539

Solution 1

I got rid of Microsoft SQL Server JDBC Driver and downloaded jTDS driver. I tweaked a bit with it until I finally got a successful connection. The correct connection string was:

jdbc:jtds:sqlserver://<server_ip>:1433;databaseName=<instance_name>;domain=<domain_name>

Solution 2

The answer may be obsolete as I had the similar problem with SQuirrel SQL on MacOS 10.9.3 not on Linux box. The way Peter solved the problem inspired me. As the solution was not most straightforward I decided to put it here. Hope it helps someone.

  1. Download latest Microsoft JDBC Driver 4.0 for SQL Server (tar.gz package)
  2. Extract only sqljdbc4.jar from the package
  3. Copy the jar file into Squirrel SQL (Contents->Resources->Java->Lib)
  4. Now Microsoft MSSQL Server JDBC Driver is available to create Alias
  5. Connection URL: jdbc:sqlserver://SERVERNAME;databaseName=DATABASENAME

Solution 3

Another solution that worked for me. On a Windows desktop connecting to SQL Server 2008 R2, I had to follow these steps:

  • copy the jtds-1.3.1.jar into the SQuirrel SQL \lib directory
  • restart SQuirrel SQL and check that you see jTDS Microsoft SQL in the drivers list
  • make sure that in the driver configuration the Class Name specifies net.sourceforge.jtds.jdbc.Driver
  • use a connection string like this

jdbc:jtds:sqlserver://<hostnameOrIp>:<port>/<databaseName>;instance=<instanceName>

Solution 4

I managed to connect to an SQL Server from SQuirrel on a linux box. Rough* steps ...

  • You only need one of the jdbc jars from the MS download (copied to 'lib')
  • Must use SQL Server auth (not windows network auth)
  • SQL Server auth was already enabled on our db
  • Added a login 'jdoe'
  • Set jdoe default database to 'XxxDb'
  • Added a 'User Mapping' from jdoe to the desired database
  • Set up permission on the SQL Server for jdoe: 'Connect' and 'View any database'
  • Connection string: jdbc:sqlserver://SERVERNAME:1433;databaseName=XxxDb

* May not need all as I poking around

Solution 5

For you to connect to MS SQL Server you need to obtain the JDBC drivers:

  • Download latest Microsoft JDBC Driver
  • Choose to download the .tar.gz package
  • Extract the package
  • In Squirrel-SQL click on Drivers tab on the left side of the window
  • Right click on Microsoft MSSQL Server JDBC Driver and choose Modify Driver...
  • Click on Extra Class Path
  • Click on Add
  • Browse to where sqljdbc41.jar is located (it should be under sqljdbc_4.1/enu/jre7/sqljdbc41.jar or similar) and click on Open
  • Click on OK
  • Now to the left of Microsoft MSSQL Server JDBC Driver in the Drivers list there should be a check mark which means that you installed the driver correctly

To connect to MS SQL Server:

  • Click on the Aliases tab on the left side of the window
  • Click on the + sign to Create a new Alias
  • Type a name for your new connection
  • In the URL text box paste the JDBC connection string (Azure gives this to you under connection strings for example)
  • enter username and password
  • click on test to see if the connection can be established
  • if test was successful then click on OK to finish creating your connection

If you are having any issues with connecting to Azure SQL database you might need to give access to your specific IP to connect to it or some similar access privileges.

Share:
77,539
gtludwig
Author by

gtludwig

Updated on October 06, 2020

Comments

  • gtludwig
    gtludwig over 3 years

    I need to connect to a SQL 2008 R2 Server from my Linux box that's not registered in my company's domain. I'm trying to use SQuirreL SQL version 3.2.1. I downloaded Microsoft SQL Server JDBC Driver 3.0 and assigned it to SQuirreL on the Drivers tab.

    Now, when I try to create an Alias on SQuirreL, I select the SQL Server driver and adjust the URL. For credentials I use my domain registered username and password.

    When I try to test the connection, I always get the same error:

    <"database-name">: Logon failure for user '<"domain">\<"domain-user">'.

    How can I get this working? Thanks in advance!