views:

189

answers:

5

I have a Vector < String >. Now i want to store those Strings in database. But i have one "but"! The program user mustn't install anything else except J2RE, he will just copy program to his computer and run. Does java has such kind of database?

P.S. Previously i think about object serialization or just simple text\xml file but according to the task it must be database... So user just copy my program and run, without installing any additional software, except J2RE.

+2  A: 

I think HSQLDB is the right choice for your problem. You just need the HSQLDB JAR in your classpath and then use the file-based database configuration

victor hugo
A: 

The only thing I know of is JavaDB, but I don't know if that's included in J2RE. For more info on JavaDB see JavaDB

Edit After reading on the JavaDB site it seems it's only included in the JDK, which I assume would be not sufficient for you.

Yngve Sneen Lindal
A: 

Why the requirement for a database? You have 1 Vector - is there any other data that is linked to each String? If you just have to search for Strings in the Vector, you can do that without a database. Ordering the list, searching for substring matches, etc can all be done using Java string functions. Even if the list contians 100,000 thousand Strings, it should still be fast.

AngerClown
+1  A: 

You can embed Apache Derby in your application. This will run on a JRE installation.

Thorbjørn Ravn Andersen
A: 

JavaDB and Derby are very closely related. JavaDB is the Sun distribution of Derby. You can get Derby directly from the Apache web site (http://db.apache.org/derby) and embed it directly into your application, and both JavaDB and Derby require only the JRE in order to run.

Bryan Pendleton