Pure java sqlite library?
I saw Java and SQLite, but what ones are m开发者_运维技巧ade in pure java and are platform independent? Also which would be the best to start with? I have never used sqlite but I assume it is like mysql. Also do any of them come with a nice command line tool for testing queries?
SQLite is getting quite a lot of hype in other language domains, however with Java you have something else available:
- HyperSQL (more commonly known as HSQLDB) is pure Java RDBMS which is specialized around running it as part of your application meaning that you can embed it to your software and it just works.
- H2 is a complete rewrite of HypersonicSQL (common ancestor for H2 and HyperSQL) and is also fully Java. One nice feature of this one is RDBMS emulation which allows it to function with SQL written specifically for, say, Oracle RDBMS.
- There's also the almost mandatory Apache Commons variation too, Apache Derby. As with the other two, Derby is also embeddable and has a small JAR file size footprint.
As for tools, well, that varies a lot. Most of the Hypersonic family products for example are mainly meant for unit testing which means that you can unit test your DB Schemas and actual queries quite easily with (almost) plain Java code.
sqljet, which in contradiction to the name does not have SQL, but can use SQLlite databases.
And updated answer, you may want to try Xerial's Sqlite JDBC driver. While its current version is not pure-java, it packages binaries for major operating systems so that it is mostly portable.
Also sqlite4java also currently packages binaries for major OSes.
精彩评论