This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storage and retrieval of data - best option?

 
joseph corner
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am writing a java server-side application which needs to store info about educational courses, and users in those courses.

When retrieving data, I need to ask:
- does this course already have an entry?
- if so, which users are listed there?

When storing data, I need to ask:
- does this course already have an entry? If so, append user entry. If not, create course entry, append user entry.

It's not convenient to use a database for this. So my question is: should I create an xml file of users for each course, then check for the existence of the course using file.exists()? Or should I put all courses and users in one xml file?
Or some other approach - perhaps not using xml?

I'm interested in terms of speed and overhead.

Thanks!
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It's not convenient to use a database for this.

I'm curious - why not?
 
joseph corner
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Long story.
- The application is a plugin in a larger web app which is hosted remotely. Setting up db connections to it is complicated.
- I want the plugin to be self-contained and portable.
I guess I could use one of those embedded databases - Berkeley? That seems a bit over the top in this case though.
[ March 19, 2007: Message edited by: joseph corner ]
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I could use one of those embedded databases
HSQL Database Engine?
Not difficult to set up on a hosting server (does not have to run as a service), portable, contained in one jar.

You can run it as an integral part of your plug-in:
In-Process (Standalone) Mode
This mode runs the database engine as part of your application program in the same Java Virtual Machine
Regards, Jan
 
joseph corner
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'll take a look at that. Do you know if HSQLDB uses up a lot of resources when used in a server-side application in this way? (Memory?)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic