aspose file tools*
The moose likes JDBC and the fly likes Why do we need a database? or why do i need it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Why do we need a database? or why do i need it?" Watch "Why do we need a database? or why do i need it?" New topic
Author

Why do we need a database? or why do i need it?

Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 53

I am using a standalone java application.. no webservice or nothing.. I have all the data(good enough to make a DB) required for my application with numerous objects.. yes.. I am simply hardcoding in my classes and constructing it while my application runs.... my application is running perfect and is quick...

but people say it is good only to maintain tables of data in a separate DB rather than hardcoding it.... but making a separate connection to a DB and fetching my application data from it would make my application slower instead of improving it.. but i also want to follow the best practise of having one DB...

can you please tell me what improvements i would get for my application by maintaining a separate DB? i have no issues in changing the code and deploying the jar everytime i change the data values..

if i have to really use a DB then which type of DB i should opt for.. please suggest some solution free of cost... is there any free to use oracle DB system? my application is not very enormous to go for a licensed DB system..

Thanks in advance..... and this my first in JavaRanch
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3434
    
  47

Welcome to the Ranch!

A database is generally only useful if you need the services it offers - be it atomicity, concurrency or constraint enforcement. Unless there is a need for users to change the configuration, or to share common configuration among many computers (which would make frequent redeployment a daunting task), I don't see any advantage of putting them into database in the situation you described. I'd say that unless the app needs a database anyway, requiring a database just for what you've described would only add an unnecessary overhead.

You might consider storing the configuration in XML or property files (possibly even within the distributed JAR) instead.
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 53

Thanks Martin..... i am unaware of XML or property files usage in JAVA but i can for sure think it would be better for me to use with my overview knowledge of XML in JAVA.

How can i start with using XML in my JAVA application? can you point me few sources?

All i can imagine is to put all the data into a plain file and read it using an InputFileReader or buffer stuff. I have done this a lot of times. Is XML a better solution than this?

How can i start using XML in JAVA?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3434
    
  47

Unfortunately, I'm not very good at XML myself. I suppose that lots of XML tutorials exist, though (try Google, I'd pick one from Sun/Oracle to begin with). Generally there are XML parser libraries, you should not read and interpret the XML file yourself!

Another option might be to use Java serialization and deserialize objects directly from XML files. Certainly harder to maintain the XMLs by hand, but very elegant in other aspects (you'll get objects from the XML files with very little code).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why do we need a database? or why do i need it?
 
Similar Threads
Java Object's cleanup procedures
Oracle 10g certifcation for Java Developer
Data access class Data must (directly) implement interface DB ?
Security features in Jboss
Question on using Websphere MQ