我被单个文件数据库所提供的简洁所吸引。在Java中连接和使用SQLite的驱动程序/连接器库是什么?
我发现了一个包装器库http://www.ch-werner.de/javasqlite,但是还有其他更突出的项目可用吗?
我被单个文件数据库所提供的简洁所吸引。在Java中连接和使用SQLite的驱动程序/连接器库是什么?
我发现了一个包装器库http://www.ch-werner.de/javasqlite,但是还有其他更突出的项目可用吗?
当前回答
示例代码导致Tomcat中的内存泄漏(在取消部署webapp后,类加载器仍然保留在内存中),这将最终导致内存溢出。解决方法是使用sqlite-jdbc-3.7.8.jar;这是一个快照,所以maven还没有显示。
其他回答
维基上列出了更多的包装:
Java wrapper (around a SWIG interface): http://tk-software.home.comcast.net/ A good tutorial to use JDBC driver for SQLite. (it works at least !) http://www.ci.uchicago.edu/wiki/bin/view/VDS/VDSDevelopment/UsingSQLite Cross-platform JDBC driver which uses embedded native SQLite libraries on Windows, Linux, OS X, and falls back to pure Java implementation on other OSes: https://github.com/xerial/sqlite-jdbc (formerly zentus) Another Java - SWIG wrapper. It only works on Win32. http://rodolfo_3.tripod.com/index.html sqlite-java-shell: 100% pure Java port of the sqlite3 commandline shell built with NestedVM. (This is not a JDBC driver). SQLite JDBC Driver for Mysaifu JVM: SQLite JDBC Driver for Mysaifu JVM and SQLite JNI Library for Windows (x86) and Linux (i386/PowerPC).
在编译和运行代码时,应该设置类路径选项值。 就像下面这样:
javac -classpath .;sqlitejdbc-v056.jar Text.java
java -classpath .;sqlitejdbc-v056.jar Text
请注意“。”和“分隔”;(赢了,Linux是“:)”)
示例代码导致Tomcat中的内存泄漏(在取消部署webapp后,类加载器仍然保留在内存中),这将最终导致内存溢出。解决方法是使用sqlite-jdbc-3.7.8.jar;这是一个快照,所以maven还没有显示。
java -cp .:sqlitejdbc-v056.jar
Java -cp .:sqlitejdbc-v056.jar;测试
注意“。jar”后面的分号,我希望这能帮助到大家,可能会给大家带来很多麻烦
David Crawshaw项目(sqlitejbc -v056.jar)似乎过时了,最后一次更新是2009年6月20日,来源这里
我推荐Xerials的Crawshaw sqlite包装叉。我用Xerials sqlite-jdbc-3.7.2.jar文件替换了sqlitejdbc-v056.jar,没有任何问题。
使用与伯尼的回答相同的语法,速度更快,并使用最新的sqlite库。
与Zentus的SQLite JDBC有什么不同?
The original Zentus's SQLite JDBC driver http://www.zentus.com/sqlitejdbc/ itself is an excellent utility for using SQLite databases from Java language, and our SQLiteJDBC library also relies on its implementation. However, its pure-java version, which totally translates c/c++ codes of SQLite into Java, is significantly slower compared to its native version, which uses SQLite binaries compiled for each OS (win, mac, linux). To use the native version of sqlite-jdbc, user had to set a path to the native codes (dll, jnilib, so files, which are JNDI C programs) by using command-line arguments, e.g., -Djava.library.path=(path to the dll, jnilib, etc.), or -Dorg.sqlite.lib.path, etc. This process was error-prone and bothersome to tell every user to set these variables. Our SQLiteJDBC library completely does away these inconveniences. Another difference is that we are keeping this SQLiteJDBC libray up-to-date to the newest version of SQLite engine, because we are one of the hottest users of this library. For example, SQLite JDBC is a core component of UTGB (University of Tokyo Genome Browser) Toolkit, which is our utility to create personalized genome browsers.
编辑:像往常一样,当你更新一些东西时,在你的代码中一些模糊的地方会有问题(发生在我身上)。测试测试测试=)