Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pure java sqlite library?

Tags:

java

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 like mysql. Also do any of them come with a nice command line tool for testing queries?

like image 880
Will Avatar asked Sep 08 '10 05:09

Will


People also ask

Can I use SQLite in Java?

To use SQLite with java programs, you must have SQLite JDBC Driver and Java set up on the system. Follow the steps given below: Download latest version of sqlite-jdbc-(VERSION). jar from sqlite-jdbc repository.

Where can I download SQLite JDBC?

To download the latest version of SQLite JDBC Driver, you go to the download page. You should download the latest version of the driver. At the time of this writing, the latest version is sqlite-jdbc-3.27. 2.1.

Can I use SQLite for free?

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private.

Is SQLite a library?

SQLite is a C library that provides a lightweight disk-based database that doesn't require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage.


1 Answers

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.

like image 195
Esko Avatar answered Oct 14 '22 19:10

Esko