I need to store information on a database that can be accessed when the program is not running(persistant storage), but I need it to be offline, without running on a server. I need something like a CSV file, but I'm not a big fan of CSV.

I want to store recipes, so I need 4 or 5 columns. It won't be big, I don't think it's going to be bigger than 10Mb. I meant that has a persistent storage, that the information will be there even if the program isn't running.

  • There are many ways to store data, and many kinds of databases. No way to recommend without detailed info from you. What kind of data? Structured or not? One list of items or more? Volume of data? What exactly do you mean by "accessed when program is not running"? Commented Jul 17, 2017 at 19:56
  • hsqldb.org or h2database.com
    – user14090
    Commented Jul 17, 2017 at 21:57
  • @a_horse_with_no_name As I can remember, it is a memoryonly db. I.e. it has no persistent storage.
    – peterh
    Commented Jul 18, 2017 at 12:39
  • Both offer persistent storage
    – user14090
    Commented Jul 18, 2017 at 12:40
  • 2
    This website lists many alternatives that can satisfy the requirements.
    – Alejandro
    Commented Jul 18, 2017 at 17:48

2 Answers 2


Spreadsheet or FileMaker

For a mere 10 megs of data in a single table (list), consider using a spreadsheet or FileMaker rather than building your own app.

Database versus File

If your data is churning (being edited, deleted, sorted, and such), then generally best to use a database. A good database helps with the integrity of your data, such as avoiding accidental overwrites from your own sloppy programming or preventing corruption due to crashing while in the middle of writing data. Protecting the integrity of your data (see ACID) is one big reason to use a database over writing your own data file such as CSV.

However, if your data is not churning, so you rarely write to it, then writing a CSV may make sense, especially if sharing this data is a primary goal. In such a case, use a library to help with the CSV or Tab-Delimited file such as Apache CSV. Always write to a fresh file before deleting the old file, to avoid losing data.

Any database will store persistent data, to be available the next time your run your app. Some databases also offer an "In-Memory" option, where the database lives only in memory, is not persistent, and disappears when the database engine is shutdown. But that is never the default, so you would have to go out of your way to lose your data that way.

H2 + Vaadin + Java

You do not give any requirements or constraints, so there is no way to make a specific recommendation. My own choice would be:

  • H2 database engine built in pure Java. Can be either embedded in your app or used separately as a database server.
  • Vaadin framework and its Vaadin Grid widget to write an web app in pure Java that is automatically rendered in a web-standards HTML5 web browser.

List of embedded databases

See this Wikipedia page for a comparison of a couple dozen embedded database engines.


SQLite has Java bindings and there is JDBC connector for it. Tutorial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.