Pure java sqlite library?

后端 未结 3 833
生来不讨喜 2021-02-20 18:04

I saw Java and SQLite, but what ones are made 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

  • 2021-02-20 18:50

    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.

    0 讨论(0)
  • 2021-02-20 18:52

    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.

    0 讨论(0)
  • 2021-02-20 18:53

    sqljet, which in contradiction to the name does not have SQL, but can use SQLlite databases.

    0 讨论(0)