I wish to save an id and some numerical data, for some items, permanently. There will eventually be a large number of items and i wish to perform searches on this data. Can anyone advise me on the best (preferably simplest) way to store this data.
Printable View
I wish to save an id and some numerical data, for some items, permanently. There will eventually be a large number of items and i wish to perform searches on this data. Can anyone advise me on the best (preferably simplest) way to store this data.
Use a database. It is the best option you have to deal with large amount of data.
What database software would you recommend is SQL a good choice? Does it work with java?
Yes it's a good choice, and work fine with Java.
To avoid database administration you can use joafip.
This made you able to save your entire data model in file and to access to any entity without loading all in memory. This make able to manage more object that memory can contains
or you could use a map and save the object if you don't know how to connect and use a mysql db using the jconnector
Save and reload a map using serialization works fine, but the amount of memory is a limitation. Using joafip it is no more the case.
In following example the map is nether enterely loaded in memory.
adding value in the map
session.open();getting value from the map
map=(PTreeMap)session.getObject("myMap");
map.put(key,value);
session.closeAndWait(EnumFilePersistenceCloseActio n.SAVE);
session.open();
map=(PTreeMap)session.getObject("myMap");
value=map.get(key);
session.closeAndWait(EnumFilePersistenceCloseActio n.SAVE);
the best way is to keep your data in Database say SQL using JDBC-ODBC driver
or you can save your data to a .dat or .csv file. using java.io.*;
try this out..
More that the driver use in an application, DB use make more effect on the application. I mean Oracle, SQL and so on.