HSQL is a cost-free pure java database. It has a small memory footprint and comes with a JDBC driver so that you can use it from your Java programs.
For further information, see hsqldb.sourceforge.net.