morgalr wrote:Have anyone told the authors of Microsoft Word this?
If you are going to store data, then I'd go to a database and use JDBC. I used to think it wouldn't be worth it unless I had several thousand rows of data, but I did a project that had some wide data (like 800 columns) and it became very apparent very quickly that the DB was the way to go.
startoftext wrote:I'm not the one who suggested using a database, so don't get snippy with me, young man. Apache Derby (JavaDB) can be run in-process or as a separate server.
So it just sends the data to a non existent database then?
startoftext wrote:There are multiple small database products out there--Oracle Light (or what ever it's called now), Microsoft Access, Java DB, and etc... These are all designed to be desktop products and can be used in any small application on the desktop. You need a JDBC driver or ODBC/JDBC bridge (included in Java) to access the databases. Even MS Excel can act as a DB through the JDBC/ODBC bridge.
I am asking a question. Could you please explain further on how exactly one can use JDBC to solve the original problem without a Database Server being involved?
DrClap wrote:First I'd back up a step and get some clear requirements.
Well, frankly, before you decide whether you need to use a database or serialized Java objects (XML or otherwise) or some other format, you ought to do some design. Figure out what kind of data you're going to have, how it is structured, and so on.
If you're just going to be storing three strings, for example,Such as that.
DrClap wrote:The data will be what is contained in three text panes. Each text pane containing rich text and images. For an example take a look at the example program in my first post.
What will the nature of the data be? Just a handful of strings? A bunch of objects of different types reflecting the current state of your program to great depth and complexity? Something else?
How will the data be used? Just write it out when the app shuts down, and read it all back in when it starts up? Do you need to query or search for specific subsets of the data? Is there any value in the stored form of the data being human-readable?Basically the data will need to be saved when the application shuts down or when the user selects save from the file menu. The data will be restored when the user opens the file from the file menu. It would be nice if the stored data is human readable but its not of primary importance.
How often will the data be written and read? How many reads/writes/bytes/etc. per second/minute?Not often. Just a simple open and save from the file menu.
How large could the data conceivably get?It will probably be a few paragraphs of formated text and less then a dozen images per text pane.
Will reading and writing of the data need to occur concurrently?no.
Do you need to add new data to the storage as your app goes along, or just replace what's there with the most current state?Replace with the most current state of the data.
If it's a simple read once at startup, write once at shutdown, overwriting the previous data, read only by your app, not by humans, then serialization via ObjectInput/OutputStream is probably the way to go. If there are other requirements, you may want to go with XML serialization, a DB, or some other solution.Thanks for the information. Serialization sounds like the way to go. Even if I end up using XML serialization in the end it would still be of interest to me to learn how to use serialization without xml.