Fog Creek Software
Discussion Board

Desktop app. Data storage / File Format?

Hello All,

Please forgive me for asking what may seem like a dumb question. I am currently a web developer and don't have any desktop software experience.

In Joel's Craftsmanship article he mentions the CityDesk file is a "database".

"...especially since our underlying database is multiuser and doesn't mind lots of processes banging on it at the same time."

And I believe I have read him referring to the MS Jet Engine, which I think is used to talk to a database on a Windows machine. Until recently I did not know you could use a DB on a desktop app. (I'm a web developer! Please don't laugh!! :) )

If I were to make a desktop application in Java (please don't start an argument about why that shouldn't be done), does anyone have a good suggestion for a DB to use? For the sake of this question, let's pretend the application is an Office-like application (like Microsoft's Office or's suite), and it would be really cool if multiple people could use the (single) file at the same time. (Like how Joel says CityDesk can.)

If anyone can point me in the right direction or educate me a little more on the Desktop Software storage stuff I would greatly appreciate it!

Thanks in advance!

Michael Sica
Monday, December 8, 2003

Have a look with MS Access first, this will help you understand a lot of the issues.

Monday, December 8, 2003

I would agree.

Have a play around with MS access first, especially using VBA, if you are only coming to terms with the concept of a database on a desktop application, then this sort of playing around would be a good place to start.

MS Access stores the database in a single .mdb file (please correct me if I am wrong). And you can use the MS Access software to create the initial database, and then access the database using your code.

I have some little experience with an application of this sort using MS Access (A very minor part of my job involves maintaining a small desktop database application that stores job information in an accounting firm of 26 staff.).

Aussie Chick
Monday, December 8, 2003

Before bothering with MS Access (and the bunch of stuff you have to deploy on each desktop to make it work)... make sure SQLite doesn't provide all you need:

Frederic Faure
Monday, December 8, 2003

CityDesk's .cty file is really a renamed .mdb file.
Monday, December 8, 2003

Take a look at

I can't tell if it exactly matches your requirements because I've just started playing with it, but it can work both in standalone and server mode and the latter I suppose supports many simultaneous connections.

Maciej Kolodziej
Monday, December 8, 2003

You will be hard pressed to create a Windows Desktop App with Java and have it use an Access DB.  For fun, yes, for profit... no.

Monday, December 8, 2003

Our desktop Java application uses zipped XML files for data storage. Of course, our data is basically sequential and loaded /saved all at once.

Monday, December 8, 2003

Thanks for the responses everyone!

Sam, I think that is how does it too. But then I'd have to add in code to lock and unlock the file and deal with multiple people hitting it (which may be the solution).

Maciej, Thanks. I found that DB too. I'm not sure if it's what i would (or could use), but when I have time, I'll probably look into that one a bit more.

I do have a question about using an .mdb file for you VB people. Does everyone that uses your software have to have a datasource setup in the control panel? (I now remember writing a small VB/Access app in college, but I was a MIS major, not CS. It was small, it sucked, and I think I had to setup something in the control panel.) Or is that what the Jet Engine is for?

Thanks again,

Michael Sica
Monday, December 8, 2003

You may have set up a DSN (Data Source Name) using the ODBC Data Source Administrator.  This is only necessary if you want to access your database in this manner.

What you will need to do is to create a connection string, in your code, which you will then use each time you establish a connection to the database.

You may want to read up on ADO/DAO or ODBC and see if there is a JAVA - driver for one of these.

Monday, December 8, 2003

You could look at Sybase ASA ( -- it's an embedded SQL DBMS which provides a great featureset with a tiny footprint (and mostly hands-off administration).

It also works nicely on Palm-type units, too, if you have any inclination to synch with those.

Monday, December 8, 2003

Actually, another application of mine uses hsqldb ( ).

It's a 100% Java SQL database that can run in memory or from disk. It's easy to use and works just like any database you can talk to using JDBC.

Monday, December 8, 2003

This all makes me think about the pros/cons of using a DB file as opposed to the XML/Zip File (OpenOffice style).

(Please correct me if I'm wrong!)

DB File Pros
-Out of the box multi-user access

XML/Zip file Pros
-More accessible to other programs. Any app that can open a zip file and parse XML can read and operate off of your app's save file.

DB File Cons
-Can't do the pro for XML/Zip file. i.e. lose the ablitly to have any other app easily access your save file's data.

XML/Zip file Cons
-Would have to write code that manages multiple people reading/writing to it?

I'm thinking the XML/Zip file has more upside. Anyone want to weigh in on that statement?


Michael Sica
Monday, December 8, 2003

I think it depends on what type of data you are storing. I chose zipped XML files for one application because it's just data that gets read in at once, used, then written back.

The other application that uses hsqld needs to be sorted and searched and selected, so I would have to write a lot of extra code if I used XML.

Monday, December 8, 2003

I don't know your requirements but given that most everyone else suggested a relational DB I'll put this suggestion out there-

Take a look at BerkeleyDB from SleepyCat.

Name withheld out of cowardice
Monday, December 8, 2003

*  Recent Topics

*  Fog Creek Home