简体   繁体   中英

Java Driver Firebird 2.5 on Mac OS High Sierra

I cloned a Java project in NetBeans 8.2 on Mac OS High Sierra that uses a Firebird database using jars jaybird-2.2.8.jar and jaybird-full-2-2-8.jar and it works well on computers with Windows 8.2 and 10, and Linux Ubuntu 16.04. The Firebird engine that I use in the development team is 2.5.8. and Java 1.8.

Using Firebird's default tool isql in the terminal works fine and Flamerobin also works, indicating that it is installed properly.

The error it throws in NetBeans, SquirreL SQL (Java), DBeaver (Java) is as follows:

Unexpected Error occurred attempting to open an SQL connection.
class org.firebirdsql.gds.impl.GDSServerVersionException: information type inappropriate for object specified
Version string "UI-V2.5.8.27089-1 Firebird 2.5DUI-V2.5.8.27089-1 Firebird 2.5/tcp (MacBook-Air-de-Ulises.local)/P10" does not match expected format
Expected engine version format: [platform]-[type][major version].[minor version].[variant].[build number] [server name]

Any idea what causes it?

The version number reported by your Firebird installation does not match the format expected by Jaybird. The problem is the -1 in UI-V2.5.8.27089-1 .

Firebird will normally report something like UI-V2.5.8.27089 ... , but the build for MacOS needed to be rebuilt due to issues with the initial build. This created a revision 1, and Jaybird does not expect that revision to be included in the version number string.

You have the following workarounds:

  1. Install a Firebird version that does not have a -1 revision

  2. Patch org.firebirdsql.gds.impl.GDSServerVersion and replace it in your Jaybird jar. The change you need to make is replacing

     private static final Pattern VERSION_PATTERN = Pattern.compile("((\\\\w{2})-(\\\\w)(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)) ([^-,]+)(?:[-,](.*))?");

    with

     private static final Pattern VERSION_PATTERN = Pattern.compile("((\\\\w{2})-(\\\\w)(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)(?:-\\\\S+)?) ([^-,]+)(?:[-,](.*))?");

I have created issue JDBC-534 for this.

This has been fixed in Jaybird 3.0.5 and 2.2.15, which is available from the Firebird JDBC driver download page .

Given you were using a relatively old version of Jaybird 2.2, I do suggest you take a look at the release notes to see all changes and fixes since version 2.2.8.

Disclaimer: I maintain Jaybird.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM