RylandAlmanza
|
 |
«
Posted
2012-03-04 22:01:49 » |
|
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?
|
|
|
|
|
_Al3x
|
 |
«
Reply #1 - Posted
2012-03-04 22:05:10 » |
|
I would go with MySQL... but I'm new in Java so... 
|
|
|
|
teletubo
|
 |
«
Reply #2 - Posted
2012-03-04 22:07:47 » |
|
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.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
_Al3x
|
 |
«
Reply #3 - Posted
2012-03-04 22:10:25 » |
|
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 
|
|
|
|
UprightPath
|
 |
«
Reply #4 - Posted
2012-03-04 22:15:55 » |
|
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.
|
|
|
|
lhkbob
|
 |
«
Reply #5 - Posted
2012-03-04 22:17:46 » |
|
I prefer PostgreSQL to MySQL from an administrative point of view. Their user model is so much saner.
|
|
|
|
65K
|
 |
«
Reply #6 - Posted
2012-03-04 22:22:14 » |
|
In a Java forum someone has to mention JavaDB aka Derby 
|
|
|
|
RylandAlmanza
|
 |
«
Reply #7 - Posted
2012-03-04 22:29:18 » |
|
Thanks everyone! That's just about all the information I needed! 
|
|
|
|
|
|
|
Riven
|
 |
«
Reply #9 - Posted
2012-03-04 22:33:54 » |
|
I prefer PostgreSQL to MySQL from an administrative point of view. Their user model is so much saner.
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. 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
lhkbob
|
 |
«
Reply #10 - Posted
2012-03-04 22:36:50 » |
|
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.
|
|
|
|
ra4king
|
 |
«
Reply #11 - Posted
2012-03-05 00:27:01 » |
|
I've heard H2 is an excellent and fast Java database software.
|
|
|
|
ReBirth
|
 |
«
Reply #12 - Posted
2012-03-05 01:44:05 » |
|
H2 and mySQL are great. I heard mostly game use H2 than mySQL.
|
|
|
|
65K
|
 |
«
Reply #13 - Posted
2012-03-05 08:52:17 » |
|
I would also favor Postgres over MySQL. For database access, MyBatis is worth a look.
|
|
|
|
theagentd
|
 |
«
Reply #14 - Posted
2012-03-05 10:47:54 » |
|
I prefer PostgreSQL to MySQL from an administrative point of view. Their user model is so much saner.
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.  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". 
|
Myomyomyo.
|
|
|
Riven
|
 |
«
Reply #15 - Posted
2012-03-05 11:11:25 » |
|
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.
|
|
|
|
R.D.
|
 |
«
Reply #16 - Posted
2012-03-05 11:15:07 » |
|
It's the same concept as 'iMac, iPod, iPhone, iPad', it feels accessible.
Sadly, it isn't 
|
|
|
|
Riven
|
 |
«
Reply #17 - Posted
2012-03-05 11:17:34 » |
|
It's the same concept as 'iMac, iPod, iPhone, iPad', it feels accessible.
Sadly, it isn't  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 
|
|
|
|
Archibald
|
 |
«
Reply #18 - Posted
2012-03-05 13:13:23 » |
|
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.
|
|
|
|
|
cylab
|
 |
«
Reply #19 - Posted
2012-03-05 15:25:47 » |
|
Some more two cents:
- prefer PostgreSQL over MySQL - stay away from OR-Mappers like Hibernate
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Riven
|
 |
«
Reply #20 - Posted
2012-03-05 15:35:38 » |
|
Some more two cents:
- prefer PostgreSQL over MySQL - stay away from OR-Mappers like Hibernate
There are OR-Mappers and there are OR-Mappers. Yes, full blown OR-Mappers with their own SQL dialect are a pain in the ass, but at the other end of the spectrum, it's an even nastier pain in the ass to have to stuff those resultsets into HashMaps or instances of your own classes manually. I usually work with utility methods that for generate the often used queries, like a simple SELECT statement (listing the columns in a table) and methods that pump the resultset into instances of classes that have the same structure as the table. It has support for foreign keys, to make it a bit more convenient. If I weren't allowed to use such a minimal OR-Mapper, I'd probably quit that job. Life is too short to write SQL in Java. 
|
|
|
|
ReBirth
|
 |
«
Reply #21 - Posted
2012-03-06 15:33:39 » |
|
OR-Mapper? that things that translate my object class into table?
|
|
|
|
cylab
|
 |
«
Reply #22 - Posted
2012-03-06 21:49:20 » |
|
Life is too short to write SQL in Java.  I lately had a project with JOOQ, but I am not quite sure, if I like it or not...
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Json
|
 |
«
Reply #23 - Posted
2012-04-21 14:13:43 » |
|
When picking your data store I'd say it's not about what language you're writing your code in, but rather what kind of data you're intending to store and what the requirements around reading and writing are.
I would also suggest you stay away from OR frameworks or at least seriously evaluate the pros and cons of using one. They tend to put you in a right mess if you use them the wrong way.
|
|
|
|
|
Danny02
|
 |
«
Reply #24 - Posted
2012-04-21 17:10:40 » |
|
I really liked using hsqldb. Its a Java DB with some quite nice features. -in memory db inside your own application(no server setup required). -write some sql commands in java(don't know what they are called, like insertion hooks)
|
|
|
|
|
SwampChicken
|
 |
«
Reply #25 - Posted
2012-04-24 11:28:47 » |
|
hsqldb -> H2
|
|
|
|
|
|