I have a Firebird DB file, test.fdb in some directory, I want to access the DB from java application. What are the required libraries files to access.
I am using Jaybird JDBC Driver to access the embedded Firebird database, but I'm getting the error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jaybird22_x64 in java.library.path
I tried downloading and adding the jaybird22_x64.so file by System.setProperty("java.library.path", "/home/sk/Desktop/Jaybird/");
and also with System.load() and -Djava.library.path
The jaybird folder contains the file jaybird22_x64.so file.
I am using Ubuntu 17.04, with kernel 4.10.0-42-generic
Here is the exception I get.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jaybird22_x64 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at org.firebirdsql.gds.impl.jni.JniGDSImpl.initJNIBridge(JniGDSImpl.java:64) at org.firebirdsql.gds.impl.jni.JniGDSImpl.(JniGDSImpl.java:25) at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40) at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:275) at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:123) at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:130) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at test.TestJavaFireBird.main(TestJavaFireBird.java:33)
Can anyone help, what libraries are required and how to load them?
It looks like the binaries from the Firebird website don't work on Ubuntu. So to use Firebird embedded on Ubuntu 17.04, the simplest is to install Firebird 3.0 server using:
In the install, make sure to enter a password for the sysdba account.
This will install and start a full Firebird 3.0 server, but the alternative is to compile Firebird yourself. You can stop and disable the server process using
Next, you will need to add yourself to the Firebird group to get access to
/tmp/firebird
for the shared lock-files:Reboot to get access to the group. This shouldn't be necessary, but I couldn't get the group without a reboot on my machine.
After getting this working, you can try to get it working without adding yourself to the firebird group by specifying the lock-path using the
FIREBIRD_LOCK
environment variable.Next use Jaybird 3.0 and JNA 4.4.0 to run your Java application. If you want to use Jaybird 2.2, you will need to compile the libjaybird22_x64.so yourself.
If you really need to use Firebird 2.5, then you may want to look at https://askubuntu.com/questions/945327/how-to-installing-firebird-on-ubuntu-16-04 although I'm not sure this will still work on 17.04.