RazorSQL 导致 HSQLDB 抛出 org.hsqldb.HsqlException:需要大于“2.1.0.0”的客户端驱动程序版本。 HSQLDB 服务器版本为“2.3.4”

RazorSQL causes HSQLDB to throw org.hsqldb.HsqlException: Client driver version greater than '2.1.0.0' is required. HSQLDB server version is '2.3.4'

我无法连接到我的 HSQLDB database from RazorSQL. I am only having this issue when I am running in Server mode and when I am attempting to connect from RazorSQL

使用来自 Eclipse 数据源资源管理器的相同 URL 和应用程序本身(这是一个 Hibernate 5.2.7 应用程序),我能够在 URL “jdbc:hsqldb:hsql://localhost/SudokuHibernate”。因为我 运行 在服务器模式下连接它,所以我可以同时连接。

(注意:我不必有多个并发连接,但它使调试更容易)。数据库正在 运行 从命令行通过 ...

处于服务器模式
java -cp ../libs/hsqldb-2.3.4/hsqldb/lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:/Users/arick/src/databases/SudokuHibernate --dbname.0 SudokuHibernate

尝试从 RazorSQL, the database console shows the error message. "org.hsqldb.HsqlException: Client driver version greater than '2.1.0.0' is required. The HSQLDB 连接时,服务器版本为“2.3.4”“

注意:这是一个与 , as all of my own configuration files are explicitly referencing the same JDBC driver, from the same jar file. However, as pointed out by Fred T, the reference to '2.1.0.0', by HSQLDB 不同的问题,有点误导。真的只是说客户端和服务器有两个不同版本的JDBC驱动。

在数据库抛出版本不匹配错误的同时,RazorSQL 显示一个对话框,其中包含错误消息:

ERROR: An error occurred while trying to make a connection to the database: 
JDBC URL: jdbc:hsqldb:hsql://localhost/SudokuHibernate
connection exception: connection failure: java.io.EOFException

下面是我的 RazorSQL 连接配置文件。

RazorSQL 配置文件 驱动位置:/Users/arick/src/libs/hsqldb-2.3.4/hsqldb/lib/hsqldb.jar
JDBC URL: jdbc:hsqldb:hsql://localhost/SudokuHibernate

正如 Mark Rotteveel, the answer is similar to a related question about 所推断的那样,在独立服务器模式下 运行。

在那种情况下,Fred Toussi, the lead on the HSQLDB project, pointed out the answer was to modify the configuration file, that is used in Eclipse and Maven, to pull in the appropriate version of the HSQLDB JDBC jar file, and also to make sure the jar file didn't appear anywhere else on the classpath. Maven uses a pom.xml file for configuration; so what was needed was make sure that the correct version of the HSQLDB 是在项目的 pom.xml 文件中定义的。

在我的情况下,RazorSQL product that I was using, just happens to use HSQLDB as the embedded database for itself. If I had been using any other Java database, I may not have had this problem. But, since the RazorSQL product had already loaded its own version of the HSQLDB jar 文件,无论我在配置中为数据库连接指定什么并不重要。这是行不通的。

无论我如何更改 my 驱动程序配置文件,或 my 连接配置文件,唯一版本的 HSQLDB jar file that was going to get loaded, was the original jar file, that was already in use by RazorSQL, and that came with RazorSQL. (Note: This is true, unless RazorSQL fancy,它决定使用不同的类加载器,以及 Java 应用程序服务器常用的其他一些技巧来解决这些问题。

根据 Dan Richardson 的建议,来自 RazorSQL, the actual answer was not by modifying my configurations, but by changing the contents of the RazorSQL distribution itself. I needed to replace the jar file that is used by the RazorSQL application. This jar file is in Mac application folder for RazorSQL。此位置通常位于 /Applications/RazorSQL.app/Contents/Java/drivers/hsqldb

(注意:如果您不熟悉如何打开Mac app文件夹,您只需右键单击/Applications目录中的RazorSQL文件夹名称并使用"Show Package Contents" 菜单选项)。在我的例子中,我将原来的 hsqldb.jar 文件重命名为 hsqldb_2.3.2.jar 文件,然后我复制到 hsqldb.jar.

的最后一个分发版中