In an attempt to have an RDF-based desktop application that is both easy to deploy, and is performant, I have implemented a Jena driver for the Apache Derby project. This driver has been built against the most recent downloads from the projects, i.e. Jena 2.2, and Apache Derby 10.0.2.1. While the drivers does currently passes all of the roughly 600+ Jena unit tests recommended for ports and is currently being used in various projects it does currently have an unresolved issue (described below with workaround), and any help in resolving it will be appreciated.
A: It seems that the Jena-Derby driver runs the database in such a way that database resources are not garbage-collected/closed automatically. There are two different symptoms:
OutOfMemoryError.
Workaround: Modification of the application code to close and reopen the
Jena Model and the IDBConnection periodically.
ResultSet also being closed (ref).
This behaviour, however, does not seem to be happening with the Jena-Derby
driver. In unit tests, removing a Jena model which corresponds to removing
Derby tables fails, because of open ResultSets. This required the
modification of the Jena code base to be careful in closing all
ResultSets and ClosableIterators
solves the problem (modification have been incorporated into Jena 2.2).
B:
The TestConnection.testConcurrentThread causes the unit tests run immediately after it to fail - it is likely a simple issue, but has not been investigated.
The driver is built on significant portions of the other database drivers for Jena (most notably Postgres and Oracle), and the code is therefore distributed under the same license as Jena (BSD License).
Jena Derby Driver: [source zip - 22K] [jar - 9K]
// Load the Driver
String className = "org.apache.derby.jdbc.EmbeddedDriver"; // path of driver class
try {
Class.forName (className); // load driver
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
// URL of database server
String DB_URL = "jdbc:derby:directory:C:\\derbyTstDir\\jena;create=true";
String DB_USER = "test"; // database user id
String DB_PASSWD = ""; // database password
String DB = "Derby"; // database type
return new DBConnection ( DB_URL, DB_USER, DB_PASSWD, DB );
Please e-mail me with suggestions, comments or feedback. Thanks to Kevin Wilkinson for his help with the driver.