8

I encounter the following error when trying to connect to a database using SQuirreLSQL.

Error :

Unexpected Error occured attempting to open an SQL connection

Stacktrace :

java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:202)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:175)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$000(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$1.run(OpenConnectionCommand.java:104)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at net.sourceforge.squirrel_sql.fw.util.MyURLClassLoader.findClass(MyURLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:128)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:167)
    ... 7 more

I also tried to check Driver Properties and the following error is displayed :

Loading JDBC driver "Microsoft MSSQL Server JDBC Driver" failed. Can not load driver properties tab.

ariabele
  • 355
  • 1
  • 4
  • 9
  • 4
    Have you installed the MSSQL JDBC driver and made it available to SQuirrel via it's driver manager? Have you read the [Introduction, Features and Screen Shots](http://www.squirrelsql.org/index.php?page=screenshots) section? – MadProgrammer Jul 21 '14 at 05:16
  • 5
    I'm sorry for the late update. It turns out that I have not yet configured the driver. Issue has been resolved after I put sqljdbc4.jar in SQuirrel > Contents > Resources > Java > lib. I appreciate your reply. Thank you very much :) – ariabele Jul 21 '14 at 08:59
  • @ariabele where to find sqljdbc4.jar ? – zhanxw Jan 02 '15 at 23:41
  • 1
    @zhanxw, official download page is : https://msdn.microsoft.com/en-us/data/aa937724.aspx – ariabele May 07 '15 at 03:11

1 Answers1

4

You need to copy driver into squirrel-sql/lib folder. I've had same issue with MySql driver. After copied drived into:

$HOME/squirrel-sql-3.7/lib/mysql-connector-java-3.0.17-ga-bin.jar

and restart Squirrel - there was no error anymore.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Konki
  • 186
  • 1
  • 4