I think HSQLDB which is an Embedded Java RDBMS is the tool you need, you can simply integrate it with Spring and deploy it anywhere you want. You can use standard SQL to store ,query and retrieve data .
On the other hand Jackrabbit is a content repository not a database which has its own methods to store, query and retrieve “contentâ€, I don’t thing a content repository can replace a DBMS unless your problem at hand demands a CMS.