major refactoring of database code

Factored all of the transactions into separate classes, greatly
reducing the complexity of JDBCDatabase.