File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Choosing Database to a Java Swing Standalone Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Choosing Database to a Java Swing Standalone Application" Watch "Choosing Database to a Java Swing Standalone Application" New topic

Choosing Database to a Java Swing Standalone Application

Silvio Pedroso

Joined: Dec 17, 2001
Posts: 7
Hello guys! Hope all be just fine!

I am willing to develop a Java application (Swing) that will lay on a web-site and can be downloaded to anybody who has access to the site.

The users will, then, download the installer - I chose IZPack - and install the app locally, going off-line onward. The user may have Windows 98, 2K, XP or Linux.

The application has a lot of questions to be answered by user and then all of them will be transmmited to the same web-site when user goes on-line - Apache Axis calls to a web-service.

Locally, the app will create some reports in PDF. I'm not sure what plugin I'll use... maybe Cryonics jPDFCreator or PDFLib, don't know yet...

My questions are:
- any of you guys have other ideas about the design I've just described, critics or other suggestions?
- and, MOST IMPORTANT, what database would you guys suggest to run in both plataforms (Windows and Linux) without an installation process? To give you guys a big picture of it, suppose a VB-based sollution (:<|): I would have an EXE and a MDB (Access) database files without installing Office Professional to have access on it, however it would only run in Windows platform...

I really appreciate any support/suggestions you guys could give me based on your experience in this subject. I am specialized in J2EE solutions... this is about to be my first client application experience...

Thanks in advance,

Silvio Paiva
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
Well you haven't said anything about the purpose and use of the database, but I'd take a look at Derby - its a Java DB thats easy to embed.
Silvio Pedroso

Joined: Dec 17, 2001
Posts: 7
The pourpose of database is to be the local, standalone, relational database. I'll provide web-services to updated its tables and also load new or updated content in day-by-day activities.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

I'm also a bit confused about the requirements on the database... if the data needed to be saved is relatively small, of regular format, etc., simply saving XML documents as files locally might be worth looking into. Uploading changes would be easier also.

If you need a fully functional database, I'd second the suggestion to look into Apache Derby as an embedded database.

Another choice might be HSQLDB.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Silvio Pedroso

Joined: Dec 17, 2001
Posts: 7
This will be a BIG SIZED, OVER 50 tables database to support a standalone application to run on either Windows and Linux plataform. I'd rather have somehow a single file out of JAR working as this database instead of classes inside my application JAR as per what I have seen so far in HSQL and Derby...

You know, such like a MDB file to be accessed by my application...

I want to avoid large JAR files - this naturally depends on the application size - but I think if I use Derby/HSQL database, the Jar will increase as data growth...

I am correct about this thought?...

Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
I use derby. You can use it as an embedded DB (i.e. reading the DB files from disk) rather than over TCP/IP. This way you can package up your DB in a JAR file with the rest of your code and just use the derby*.jar files to work with the DB. No other requirements, the end-user knows nothing of it.

Derby comes with a little command line client called "ij" which acts like MySQL/PgSQL's readline client to get your database and table structures built etc.

You can get it from The documentation will get you running
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
Oh, as for jar size, if you consider 2MB large then good luck finding something else You could always use XML. These days I dount anybody is going to cry about an extra 2MB on the size of the download.

NOTE: Most of that DB size is the metadata, I haven't really populated it yet apart from creating the tables.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I've used HSQLDB for various tasks, and have been happy with it. Its jar file comes in at 632KB. HSQLDB -and I'm fairly certain that's true for all other Java databases as well- does not store the data in its jar file, but in an additional data file, which will of course grow over time as data is added. Why do you perceive this as a problem?
Silvio Pedroso

Joined: Dec 17, 2001
Posts: 7

I spent whole weekend working on this stuff... HSQL is fine, however it works better for session persistence - mainly in memory.

In time, I went thru Derby engine files and this database is the last word in free relational enhanced database. It has everything others have, such as backup, restore, embedded or client connection, secured communication, lock advanced structure and other funcionalities I am really surprised!!

I suggest everybody who face the same need to carefully analize Derby database - an Apache product which is my last word - in my SCAE humble opinion - to create client-server standalone applications. (btw, why am I a 'greenhorn' on this site?!). Any security, access, locks, tables, indexes, constraints, tuning... you guys must see what Derby has to us...

Btw, the jar file doesn't increase its size... you can put another secured place to have our database, thus, no increase at all... its faster, more then Postgres or Ingres and from IBM, but much better since its became a community product as usual...

Thanks for all informations and efforts you guys have driven to me and anything you guys need on J2EE/J2SE or others, count on me to help you guys!

Thanks for all!

Silvio Pedroso
[ January 14, 2007: Message edited by: Silvio Pedroso ]
I agree. Here's the link:
subject: Choosing Database to a Java Swing Standalone Application
It's not a secret anymore!