Java和SQLite [关闭]

本文翻译自:Java and SQLite [closed]

I'm attracted to the neatness that a single file database provides. 我被单个文件数据库提供的整洁所吸引。 What driver/connector library is out there to connect and use SQLite with Java. 什么驱动程序/连接器库可以连接并使用SQLite和Java。

I've discovered a wrapper library, http://www.ch-werner.de/javasqlite , but are there other more prominent projects available? 我发现了一个包装库, http://www.ch-werner.de/javasqlite ,但还有其他更突出的项目吗?


#1楼

参考:https://stackoom.com/question/Aj3/Java和SQLite-关闭


#2楼

David Crawshaw project(sqlitejdbc-v056.jar) seems out of date and last update was Jun 20, 2009, source here David Crawshaw项目(sqlitejdbc-v056.jar)似乎已过期,最后更新时间为2009年6月20日, 来源此处

I would recomend Xerials fork of Crawshaw sqlite wrapper. 我会推荐Crawshaw sqlite包装器的Xerials fork I replaced sqlitejdbc-v056.jar with Xerials sqlite-jdbc-3.7.2.jar file without any problem. 我用Xerials sqlite-jdbc-3.7.2.jar文件替换了sqlitejdbc-v056.jar没有任何问题。

Uses same syntax as in Bernie's answer and is much faster and with latest sqlite library. 使用与Bernie的答案相同的语法,并且速度更快,并且使用最新的sqlite库。

What is different from Zentus's SQLite JDBC? 与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. 最初的Zentus的SQLite JDBC驱动程序http://www.zentus.com/sqlitejdbc/本身是使用Java语言的SQLite数据库的绝佳工具,我们的SQLiteJDBC库也依赖于它的实现。 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). 但是,它的纯java版本完全将SQLite的c / c ++代码转换为Java,与其本机版本相比要慢得多,后者使用为每个操作系统编译的SQLite二进制文件(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, eg, -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. 要使用sqlite-jdbc的本机版本,用户必须使用命令行参数设置本机代码(dll,jnilib,so文件,即JNDI C程序)的路径,例如-Djava.library.path = (dll,jnilib等的路径),或-Dorg.sqlite.lib.path等。这个过程容易出错,并且告诉每个用户设置这些变量很麻烦。 Our SQLiteJDBC library completely does away these inconveniences. 我们的SQLiteJDBC库完全消除了这些不便之处。

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. 另一个区别是我们将这个SQLiteJDBC库保持最新版本的SQLite引擎,因为我们是这个库的最热门用户之一。 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. 例如,SQLite JDBC是UTGB(东京大学基因组浏览器)工具包的核心组件,它是我们创建个性化基因组浏览器的实用工具。

EDIT : As usual when you update something, there will be problems in some obscure place in your code(happened to me). 编辑 :像往常一样,当你更新某些东西时,你的代码中会出现一些不明显的问题(发生在我身上)。 Test test test =) 测试测试=)


#3楼

There is a new project SQLJet that is a pure Java implementation of SQLite. 有一个新项目SQLJet是SQLite的纯Java实现。 It doesn't support all of the SQLite features yet, but may be a very good option for some of the Java projects that work with SQLite databases. 它还不支持所有SQLite功能,但对于一些使用SQLite数据库的Java项目来说可能是一个非常好的选择。


#4楼

sqlitejdbc code can be downloaded using git from https://github.com/crawshaw/sqlitejdbc . 可以使用https://github.com/crawshaw/sqlitejdbc中的 git下载sqlitejdbc代码。

# git clone https://github.com/crawshaw/sqlitejdbc.git sqlitejdbc
...
# cd sqlitejdbc
# make

Note: Makefile requires curl binary to download sqlite libraries/deps. 注意:Makefile需要curl二进制文件来下载sqlite库/ deps。


#5楼

The wiki lists some more wrappers: 维基列出了一些包装器:


#6楼

Bernie's post is very helpful. 伯尼的帖子非常有帮助。 Couldn't vote up (don't have enough reputation :( ). But it Helped a lot. Just to reiterate! 无法投票(没有足够的声誉:()。但它帮了很多。重申一下!

http://www.zentus.com/sqlitejdbc/ http://www.zentus.com/sqlitejdbc/

Here you can find the latest SQLite JDBC jar. 在这里,您可以找到最新的SQLite JDBC jar。 Just add the jar into you classpath and you are done! 只需将jar添加到classpath中即可完成! :) You can run Bernie's sample code to test if everything is fine. :)您可以运行Bernie的示例代码来测试一切是否正常。

http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html http://www.sqlite.org/lang.html http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html http://www.sqlite.org/lang.html

Here you can find some help on SQL syntax for SQLite. 在这里,您可以找到有关SQLite的SQL语法的一些帮助。 Cheers to SQLite :) 欢呼来到SQLite :)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值