SQLite和JDBC:返回UnsatisfiedLinkError [英] SQLite and JDBC: returns UnsatisfiedLinkError
问题描述
我在VirtualBox中运行Xubuntu。我安装了sqlite3,由于某种原因不再捆绑。我将sqlite-jdbc-3.8.7.jar添加到我的构建路径并运行这个简单的代码来测试它。
I am running Xubuntu in VirtualBox. I installed sqlite3 which for some reason does not come bundled any more. I added sqlite-jdbc-3.8.7.jar to my build path and run this simple code to test it.
import java.sql.*;
public class JDBC_test {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("org.sqlite.JDBC");
Connection connection = DriverManager.getConnection("jdbc:sqlite:test.db");
connection.close();
}
}
我收到此错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
at org.sqlite.core.NativeDB._open(Native Method)
at org.sqlite.core.DB.open(DB.java:161)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:145)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:66)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:21)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:23)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
at org.sqlite.JDBC.createConnection(JDBC.java:114)
at org.sqlite.JDBC.connect(JDBC.java:88)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at JDBC_test.main(JDBC_test.java:7)
当我尝试连接到现有数据库时,我收到同样的错误用test.db替换文件的完整路径。有什么想法吗?
I get the same error when I try to connect to an existing DB by substituting "test.db" with the full path to the file. Any ideas why?
推荐答案
xerial的驱动程序版本3.8.7中有一个错误错误跟踪器。快速(和工作)的解决方案是使用驱动程序版本3.8.6,直到修复该错误。
There is a bug in driver version 3.8.7 in xerial's bug tracker. The quick (and working) solution is to use driver version 3.8.6 until that bug will be fixed.
更新:自版本3.8.10.2以来修复了该错误(请参阅 Github 上的新bug跟踪器,我确认它现在有效。
Update: the bug was fixed since version 3.8.10.2 (see new bug tracker on Github), I confirm that it works now.
这篇关于SQLite和JDBC:返回UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!