0

I've to save some data for a Java game. All guides that I found for hibernate assumes that mysql or another database management system is installed. I can't assume that since it is a game, I don't know who will install it. There's a way to programmatically create and use a DB? Is that a good solution?

Thanks

Edit: it's a desktop based game

2
  • Is that desktop based game or mobile game? Commented Mar 25, 2013 at 9:14
  • 2
    Check for embedded databases. Commented Mar 25, 2013 at 9:15

3 Answers 3

2

You can use one of embedded db, like JavaDB (ex. Derby). Support of this database is added to JRE. So all your client need is installed JRE. And you get full relational database without any installation and other stuff setup.

There are other embedded DBs like HSQLDB, SQLite

Sign up to request clarification or add additional context in comments.

2 Comments

@Luca : Accept answer then :)
Derby ships with the JDK, but you'd still need to include derby.jar with the deployment, right? It doesn't come with the JRE (at least Oracle's)?
1

H2 is a good option for an embedded database

http://www.h2database.com/html/main.html

You use it like any other relational database, so it can be used with Hibernate. But the database can be stored in files on the system, rather than in another process / machine (as you would in the bigger databases).

There are other embedded databases, but I've had good experiences with H2

Comments

1

I prefer HSQL. It more compact-able. Only one jar file enough to install and use.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.