4

I am trying to connect to MS SQL server database from linux. I can connect with Microsoft SQL server management studio on windows to same. I am trying to use squirrel sql client. I am not sure about the driver I need to use and how to install it.

Cœur
  • 37,241
  • 25
  • 195
  • 267
mrk m
  • 125
  • 1
  • 3
  • 15

2 Answers2

6

You want to get the JDBC driver from Microsoft and add it to the Squirrel classpath.

  • Download the driver from http://www.microsoft.com/en-us/download/details.aspx?id=11774
  • Get the .tar.gz for the 4.0 driver or 4.1 preview.
  • Expand the .tar.gz file on your Linux system.
  • Open Squirrel SQL
  • Click the Drivers tab in the upper left and find the entry for Microsoft MSSQL Server JDBC Driver
  • Double click the entry to open the settings for it
  • Click the Extra Class Path button
  • Click the Add button and select the sqljdbc4.jar or sqljdbc41.jar extracted above
  • In the Class Name field, enter com.microsoft.sqlserver.jdbc.SQLServerDriver

Edit: adding JDBC URL example - The JDBC URL syntax for the Microsoft driver is explained here.

The general form of the connection URL is

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
Kyle Bachmann
  • 326
  • 3
  • 16
Eric Hedstrom
  • 1,627
  • 10
  • 13
  • Thanks for your answer. Now when I am tryig to connect to MS SQL server I am getting sql exception that URL is invalid. The URL is `jdbc:microsoft:mssql://myserver.mydomain.com:1433` The server to which I am trying to connect needs odbc driver. I will need different(odbc) driver I think. Is that jTDS MSSQL driver ? – mrk m Nov 27 '14 at 05:14
  • mrk m: I still can't add a MSSQL deriver to my SQuirrelSQL, but WRT to your issue, I think the URL needs to say `jdbc:sqlserver://:1433;databaseName=` ? – aqn Jul 29 '15 at 18:57
  • Yes, for example `jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;` . You can also add `user=myUsername;password=myPassword;` to include your authentication info. – Eric Hedstrom Aug 17 '15 at 18:00
  • Thank you! I spent almost a day in the docs trying to figure this out. Their documentation surely sucks. – Chisko May 09 '17 at 22:28
1

its a lot easier to just drop the driver jar into the squirrel lib folder. squirrel will find it and use it.

Jason
  • 526
  • 7
  • 9