tags:

views:

38

answers:

2

Using a test app to figure out problems with production application and hsqldb.

If I compile the test app with the hsqldb.jar file as an external jar in eclipse the program works. However, if I only have the jar file in my JRE system library I get a pre-9.0 client attempted to connect error from the database.

The two files are the exact same files. Only difference is one was added as external jar and the other was just in the class path. When production app builds it is using classpath to same file and generating the same pre-9.0 error.

A: 

The jar you want to use is an HSQLDB version 2.0 jar. There is a second HSQLDB jar which is version 1.8 and is in your classpath before your intended jar.

This is a classpath issue. You should be able to find where the second jar (1.8) is and how it gets into the classpath by using java -verbose or other debugging options.

[added] An additional step you could take to debug this in your application is to print out the value of the field org.hsqldb.persist.HsqlDatabaseProperties.THIS_FULL_VERSION before connecting to the database. This will print the version of the jar used as the client. A successful connection means the client and server jars are the same version.

The server instance prints out its version to the console when it starts.

I would also recommend using the latest snapshot jar for HSQLDB from the http://hsqldb.org/support/ page.

fredt
That would make sense if it were the case. The executable JAR file is being created on a machine where only 2.0 exists. When the JAR is run on the Linux VM I get the error unless I add hsqldb.jar as an external JAR in eclipse.
Trevor
The same pre-9.0 error occurs when I build the solution on Linux when I specify the hsqldb.jar file in the class path. I'm still working on the problem and will try a test build without the hsqldb.jar file I have loaded.
Trevor
looking good that that may be the case. Removed 2.0 from system and application still works and with same error.
Trevor
Still running into problems. More info: using hibernate with entity manager factory so there is actually no references to hsqldb directly in code. When I java -verbose working app no hsql classes are there.I'm still left with the external jar it works - if just in JRE directory it does not.
Trevor
A: 

Sorted out problem by moving hsqldb.jar to first declared in classpath.

Trevor