I'm thinking of using flat file as database. But I don't know how good it is.
Can someone point me a reference to a good API in accessing flat file? What type of file is good for this? Can I do stuff similar to "select", "update", "insert", or "delete" ?
Instead of trying to re-invent the wheel, have you looked at databases like HSQLDB (on SourceForge), which also store data in human-readable text files, but have the benefit of using JDBC?
Thanks for the reply. I've tried to look at hsqldb, and the problem for me is that we have to install java in order to use it.
I prefer not to have to install Java, because I am going to deploy my application (swing application) on a lot of client. I prefer an one-click install to deploy it, while if using hsqldb, my prediction is that it's gonna take more effort. That's why I'm thinking of using flat-file, because we don't have to install any database engine. Please correct me if I'm wrong.
The whole idea of HSQLDB is that it is a small, simple, pure Java database, that you can embed in your application. You only need to include the HSQLDB JAR file or classes into your own application. You do not need to install it separately from your application.
And ofcourse, if you're writing a Swing application, your clients must have Java installed anyway, otherwise they will not be able to run it.
If I only need to include the jar file to use hsqldb, that is much better. Do I need to start the service like the other database? Can it be called by client from another pc ?
I am planning to convert my application to exe, maybe using exe4j. I haven't do a lot of experiment, but my prediction is that I don't have to install jre to run the exe. That's why I try to avoid having to install jre at all.
As Sonny and Jesper pointed out, you mentioned that you wanted this to be a Swing application. Swing needs Java -that means, at least the JRE- to be installed. So you don't need to install it again to run a pure-Java database.
HSQLDB in particular has several ways you can run it in. Either in-process in an application, or as a server, which would then be accessible to clients on other machines as well.
After a quick look at exe4j, it seems that it simply packages a Java application in a Windows executable. It does not remove the need for a JRE (although it does seem to have the option of installing one for you, if it can't find one). Either way, somehow there will need to be a JRE, so a Java database would not make your setup any more complicated. [ August 25, 2005: Message edited by: Ulf Dittmer ]