javah2squirrel-sql

Squirrel SQL & H2 plugin on Windows: ClassNotFoundException: org.h2.Driver


I am trying to use the Squirrel SQL client to connect to a H2 server instance.

The problem I am facing is that when I hit the "connect" button of the server I want to connect to, then I am getting a:

ClassNotFoundException: org.h2.Driver

I thought it was because h2.jar was not in the classpath. Then I edited squirrel-sql.bar to try two things.

The first thing I tried is to add the JAR into the PATH like this:

SET PATH=%PATH%;C:\Program Files\squirrel-sql-3.5.3\plugins\h2.jar

Then I restarted Squirrel. Same error.

Then I tried adding:

set TMP_CP=%TMP_CP%;"C:\Program Files\squirrel-sql-3.5.3\plugins\h2.jar"

Then I restarted Squirrel. Same error.

When I look at the console, I can see that h2.jar is in the PATH and/or the SQUIRREL_CP but the same error occurs all the time.

I am wondering if I am not forgetting something bout how to install/configure SQuirrel and/or H2?


Solution

  • I found the issue to my problem. I was linking to the h2 file in Squirrel SQL. However, I had to link to the h2 file from the H2 application... What I did to solve my issue is to add a line to the addpath.bat file such that the file looks like:

    set TMP_CP=%TMP_CP%;%1
    set TMP_CP=%TMP_CP%;"C:\Program Files (x86)\H2\bin\h2-1.4.181.jar"
    

    Then I restarted Squirrel SQL and everything was working as expected!