Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy database to deploy with a Java SE application

Tags:

java

database

api

I have a Java SE application, and it uses a database. I am currently using XML files to store data, but I´m afraid it causes some errors in later use.

So it would be good to use a Postgree/MySQL like DB. A real database. but the problem is, it is a commercial application, it runs under windows, and should be 2 clicks to install. I really don't like the idea of installing a database together with my application, and then running scripts to build the tables.

Is there a database that I can use as a Java API? Or should I just continue to use XML? (I'm synchronizing every access to my XML files). Whats the best choice?

like image 230
fredcrs Avatar asked Nov 29 '22 17:11

fredcrs


2 Answers

One of following embedded databases:

  • HSQLDB
  • H2
  • Derby

They are lightweight, take up very little space and can be embedded without problems in your application.

Since they are written in Java, and each one is a simple jar file, your deployment headaches will be kept to a minimum.

You've mentioned MySQL and PostgreSQL. Although I haven't tried it, H2 features several compatibility modes for various popular databases, including ones you've mentioned.

like image 122
darioo Avatar answered Dec 05 '22 01:12

darioo


H2 Database

It can be embedded in your application with no clicks to install and it supports JDBC and most ORMs.

like image 27
willcodejavaforfood Avatar answered Dec 05 '22 01:12

willcodejavaforfood