Search code examples
javajdbcfirebirdlibreoffice

How to connect to Firebird using LibreOffice


I have to create some reports using LibreOffice. I need to connecto a Firebird database using JDBC. I installed the driver (adding it to the classpath) and configured my connection to use

firebirdsql://server:alias
org.firebirdsql.jdbc.FBDriver

when I test the class I get this error:

"could not load driver class org.firebirdsql.jdbc.FBDriver"
javax/resource/ResourceException

I tried in another machine and got the same message. Is there anything extra that should be added to classpath? What I´m missing here? I have both JRE and JDK installed and I´m using the first located in C:\Program Files(x86)\Java\jre7. There is no classpath environment variable defined nor global or for the user


Solution

  • Jaybird has a required dependency on JCA (Java Connector Architecture), specifically JCA 1.5 (although newer should work as well), as documented in the Jaybird 2.2.5 releasenotes,

    This means you need to include either connector-api-1.5.jar (from the lib folder) on the classpath, or you need to use jaybird-full-2.2.5.jar as that includes the classes from connector-api-1.5.jar.

    Also your url is incorrect on two things: The format of the url is

    jdbc:firebirdsql[:<subprotocol>]://<host>[:<port>]/<path-or-alias>
    

    Which mean that :alias is wrong (it should be /alias). And as also remarked by Gord Thompson in the comments, you need to use the subprotocol oo, so you need to use protocol prefix jdbc:firebirdsql:oo to address difference in interpretation on JDBC, as also documented here. So your url should probably look like:

    jdbc:firebirdsql:oo://server/alias