Choosing a database software

I’m about to make a game to test networking in java (I’ve worked with networking in other programming languages, so I’m semi-familiar with it.) It seems that every language I’ve tried has a different preferred database software. For PHP, it was MySQL. For Javascript (Node.js) it was either MongoDB or Redis. etc. What’s java’s preferred database? Anyone have some recommendations?

I would go with MySQL… but I’m new in Java so… :frowning:

I use MySQL since it’s free and it’s okay.

However I don’t know why you’re worried with that right now. You should just do your network code and make it work, then when you have something done, start thinking about persistence.

Also, with enough abstraction, can’t you make your core software database-“independant” and later use anyone you chose? I mean, this way you’ll have to tweak a few calls and that’s it.

I think :stuck_out_tongue:

Yes, very much so.

I’ve actually got a content system written where I’d just have to change a few SQL statements to go from Oracle to MySQL. And even then, it’s mainly in the way I handle locks.

If your system is tied to a specific DB, then you’re probably doing something very wrong.

I prefer PostgreSQL to MySQL from an administrative point of view. Their user model is so much saner.

In a Java forum someone has to mention JavaDB aka Derby :wink:

Thanks everyone! That’s just about all the information I needed! :slight_smile:

derby is written in java, Hibernate is in java and is not a relational database, but a object-relational mapping (ORM): you can store object!

PostgreSQL is far superiour to MySQL. The only thing holding it back is the unpronounceable name. Imagine introducing both MySQL and PostgreSQL to your manager, now imagine what he’ll pick. Yes, that’s how it goes. :cranky:

Not really, Hibernate translates the Java object definition into an equivalent relationship schema, and then automatically performs SQL queries to update, insert and select rows and convert them into java objects using byte code and reflection.

I’ve heard H2 is an excellent and fast Java database software.

H2 and mySQL are great. I heard mostly game use H2 than mySQL.

I would also favor Postgres over MySQL.
For database access, MyBatis is worth a look.

I find that incredibly amusing, since MySQL was made by a Swedish guy and named after his daughter, My. “My” in Swedish is pronounced like a long version of the Y in “mystic”, not like the English word “my” as in “My own car”. Even funnier “mys-kul” (same Y as in the name My) would mean something similar to “cuddle fun”. ;D

Interesting, but you have to agree that ‘that swedish guy’ was not a complete moron and realized that everybody else would read is as the english ‘my’, making it feel friendly towards the developer (and manager). It’s the same concept as ‘iMac, iPod, iPhone, iPad’, it feels accessible.

Sadly, it isn’t :frowning:

In marketing, it’s about what customers feel, not what you actually deliver. Bottled water is a great example of that.

But enough of this derailing :slight_smile:

You have 2 reasonable options, MySQL and SQLite. Depends what you are making. If you need a real relational database (like if you are making MMORPG) go for MySQL. If you are making something smaller (or to be more precise something with low amount of concurrent writes) go for SQLite, which is smaller, easier to install and is used on smartphones.

Some more two cents:

  • prefer PostgreSQL over MySQL
  • stay away from OR-Mappers like Hibernate