【发布时间】:2017-12-11 07:41:39
【问题描述】:
我在某个目录中有一个 Firebird 数据库文件 test.fdb,我想从 java 应用程序访问数据库。需要访问哪些库文件。
我正在使用 Jaybird JDBC 驱动程序访问嵌入式 Firebird 数据库,但出现错误
线程“主”java.lang.UnsatisfiedLinkError 中的异常:否 java.library.path 中的 jaybird22_x64
我尝试通过System.setProperty("java.library.path", "/home/sk/Desktop/Jaybird/"); 下载并添加 jaybird22_x64.so 文件
还有System.load() and -Djava.library.path
jaybird 文件夹包含文件 jaybird22_x64.so 文件。
我使用的是 Ubuntu 17.04,带有kernel 4.10.0-42-generic
这是我得到的例外。
线程“主”java.lang.UnsatisfiedLinkError 中的异常:否 java.library.path 中的 jaybird22_x64 位于 java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) 在 java.lang.Runtime.loadLibrary0(Runtime.java:870) 在 java.lang.System.loadLibrary(System.java:1122) 在 org.firebirdsql.gds.impl.jni.JniGDSImpl.initJNIBridge(JniGDSImpl.java:64) 在 org.firebirdsql.gds.impl.jni.JniGDSImpl.(JniGDSImpl.java:25) 在 org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40) 在 org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:275) 在 org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:123) 在 org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:130) 在 java.sql.DriverManager.getConnection(DriverManager.java:664) 在 java.sql.DriverManager.getConnection(DriverManager.java:247) 在 test.TestJavaFireBird.main(TestJavaFireBird.java:33)
谁能帮忙,需要哪些库以及如何加载它们?
【问题讨论】:
-
请指定您使用的确切值。
java.library.path需要一个包含 .dll(或 .so)的文件夹,而不是文件本身的路径。 -
无论如何,升级到 Jaybird 3 并关注 lawinegevaar.nl/firebird/jaybird_embedded_example.html 会更简单
-
我在 java.library.path 中添加了带有完整路径的 jaybird22_x64.so 文件
-
编辑您的问题并显示确切的值,因为我不知道“完整路径”是指包含 .so 的文件夹的完整路径还是文件的完整路径。你应该使用前者,而不是后者。
-
您能否指定您使用的是哪个操作系统,如果是 Linux,确切的内核版本?您能否还包括异常的完整堆栈跟踪,而不仅仅是消息?
标签: firebird firebird2.5 jaybird firebird-embedded