Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (537)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Database solutions with Java?  (Read 1680 times)
0 Members and 1 Guest are viewing this topic.
Offline Sequalit

Junior Member





« Posted 2006-03-23 02:33:00 »

I am going to develope some java software that will require saving data and input and output and to keep transactions of things... myq uestion is, what is the best way to go about storing data through java? Should I use MySQL or is threa  native java class that will create a database just for my application? I know everything has to go into some sort of file, but im not sure on how to go about doing it... at least something that is secure instead of saving the info into a text file.

while(gettingTired())
     crankOutMoreCode();
     if(asleep()){
          wakeUp();
          makeCoffee();
          chugCoffee();
     }
}

-Sequalit
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #1 - Posted 2006-03-23 06:51:43 »

If you need an embedded database, try hypersonic SQL  http://www.hsqldb.org/

Offline Mr_Light

Senior Member




shiny.


« Reply #2 - Posted 2006-03-23 08:47:42 »

so many flavors.

to file: FileWriter and what not
There are property files (a dictionary that is stored in a textfile.) <offtopic>which uses ISO 8859-1 why not UTF-8? or something user settable?<offtopic>

Databases
 JDBC
wenn it comes to storing objects there is
 Serilisation
 ORM mapping

etc etc. Whats the best? whats the best OS? whats the best type of orieo cookies? - all is subject to what you need it for, availability and personal preference. In other words what are your requirements what is the target development eviorment etc.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #3 - Posted 2006-03-23 13:17:36 »

Hi

Use hibernate to abstract the db layer, and then any number of databases will do. hsqldb if you want an in memory small db that saves to files. You can replace with with anything you want later like MySQL etc.

Endolf

Offline Mr_Light

Senior Member




shiny.


« Reply #4 - Posted 2006-03-23 22:02:53 »

yeah and add spring to decouple your program unit test and the whole party.

I'm reluctant to sugjest anything untill I know the requirements what if he only needs to store a few highscores, use what is the best for the job. hibernate is an ORM and a good one but it all depence on what you need it for if you should use it.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #5 - Posted 2006-03-23 22:20:53 »

Yeah. I've not really used spring in anger in a production environment yet. It looks like it might be useful for injecting dependencies when testing and injecting the real things in release mode, but I can't see that that is really a huge advantage. I suspect that I am missing alot of spring in the short look I have had at it.

ORM though, andin particular hibernate (as I've used it) does seem to add value and increase productivity though.

But yes, without knowing a bit more it's hard to guess at what you need. It may be that you are not wanting to store objects, in which case, ORM is totally useless.

As swpalmer pointed out though, HSQLDB does seem to answer your initial question.

Endolf

Offline Sequalit

Junior Member





« Reply #6 - Posted 2006-03-25 02:17:57 »

sorry i have been unable to reply, hard to get computer access sometimes int his household...

what im making is some budgeting software, just for kicks.. and what im going to have is the current budget, a list of transactions, and a username/password so you can make youro wn budget account on each computer. I will need it to save to files so the user can close the application.

Also i could use something for highscores lists on a java game i have developed, it sends your score to my java server and it saves it to a file and stuff... what would be best in each situation? i know MySQL, and that HSQL thing looks appealing.. no clue what serialism or ORM mapping means.

target development environment: cross plateform would be spetacular but windows is the main one im shooting for.

while(gettingTired())
     crankOutMoreCode();
     if(asleep()){
          wakeUp();
          makeCoffee();
          chugCoffee();
     }
}

-Sequalit
Offline Mr_Light

Senior Member




shiny.


« Reply #7 - Posted 2006-03-25 13:51:17 »

http://en.wikipedia.org/wiki/Object-relational_mapping

depending on if you want to beable to export the stuff or not differend options are avail.

provided I gues the other requirements I would use hibernate and probebly along with spring. Because most of the documentation is web aplication orientated it might be wise to first use some and get to know JDBC. well I suppose you should just try hibernate and if you seem to hit a brick wall because you can't find the right documentation you can always fall back on jdbc.

for the highscores I'd use simple JDBC, since you don't have a fancy model or anything other then simple transactions. Or perhaps a properties file that you would export as xml so you can display it on your website easely.

http://java.sun.com/docs/books/tutorial/essential/io/serialization.html

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline cylab

JGO Ninja


Medals: 38



« Reply #8 - Posted 2006-03-25 16:46:55 »

To store arbitrary java objects in xml I would suggest XStream. It's by far the easiest sollution I've ever used to store and load data in my java programs. See the Two Minute Tutorial to see for yourself.

Mathias - I Know What [you] Did Last Summer!
Offline Sequalit

Junior Member





« Reply #9 - Posted 2006-03-26 22:18:08 »

Xstream seams to be a very nice option....

But what about if i build my application for a small business, to where they set up a server and then each employee has a client script, and the server deals with storing the information and securing it and stuff? would i encrypt the stuff before i store into an xml file?

while(gettingTired())
     crankOutMoreCode();
     if(asleep()){
          wakeUp();
          makeCoffee();
          chugCoffee();
     }
}

-Sequalit
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mr_Light

Senior Member




shiny.


« Reply #10 - Posted 2006-03-27 02:04:50 »

if ppl have diskaccess and it's properly setup you don't need to encrypt it just do you security at the door of your server ie your server application.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline Sequalit

Junior Member





« Reply #11 - Posted 2006-03-29 02:10:03 »

well im just thinking about possible hacker attempts and how to create secure code to defend against it...(im also thinking php-style too where everything can be from a unknown source)

while(gettingTired())
     crankOutMoreCode();
     if(asleep()){
          wakeUp();
          makeCoffee();
          chugCoffee();
     }
}

-Sequalit
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (16 views)
2014-08-01 22:53:16

CogWheelz (15 views)
2014-08-01 22:51:43

CopyableCougar4 (18 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (42 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

Resources for WIP games
by CogWheelz
2014-08-01 18:19:50

List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!