z.m_wu@att.net wrote:
Another question. Is there any java equivalent of Perl hash/db
files? I want
to store a few pieces of data on the disk.
If you really want literal Berkeley DB, apparently there is a
Java port of it (maintained by Oracle, the same people who now
maintain the regular/original Berkeley DB):
http://www.oracle.com/technology/products/berkeley-db/je/index.html
I have never tried it out and don't know how mature it is, but
it might be worth a look.
More generally, I would say Berkeley DB is a good solution if
your goal is to manipulate a subset of a large amount of data
(and you don't want to or can't load it all into RAM), but it
probably isn't the best solution for everything. There are
other technologies out there for Java that assist you with
loading and storing data. For example, you can serialize objects
to/from XML. One of these technologies might allow you to store
a more convenient data structure that the key/value pairs that
Berkeley DB allows for. If you give more specifics about what
you're trying to accomplish, maybe somebody can recommend one.
The Derby database, a.k.a. the "Java DB", comes with Java 6 and above.
PostgreSQL www.postgresql.org is an excellent choice, also. These are full,
(mostly-)SQL-compliant DBMSes.
to either a simple "name=value" text file or to XML.
java.io.Serializable conventions or other mechanisms.