• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic