Jdbcdatastore plug-in

From JMoney

Jump to: navigation, search

The JDBC Datastore plug-in provides a means of storing the accounting data in a relational database. If you use this plug-in then you do not need the XML datastore plug-in, though both plug-ins do happily co-exist.

This plug-in is configured to work by default with the HSQLDB database using an in-process engine. The driver is checked in as a part of this plug-in, so this plug-in will work 'out-of-the-box' with no database configuration necessary. The data files will be called account.* and will be placed in the active directory. You can change this by changing the sub-protocol data in the JDBC Connection preference page.

If you want to do extensive testing and/or debugging then you may want to use other tools to look at the database while JMoney is running. As other tools cannot access the database while it is in use by an in-process engine, you must re-configure to use the engine in server mode. The HSQLDB documentation tells you how to do this. Once you have a server instance running and you have created a database, you can change the sub-protocol data in the JDBC Connection preference page. If you called the database "accounts" then setting the sub-protocol data to "hsql://localhost/accounts" should work. Note that you must create the database but JMoney will create the tables and everything else as needed. Do not create any tables yourself in the database.

The driver for version 1.0.8.7 has been checked in with this plug-in. If you are setting up a server instance of the database then you should either download version 1.0.8.7 of HSQLDB or you should be sure to update the driver.

Using JMoney with SQL Server

This plug-in has been tested with SQL Server using the JTDS driver. The JTDS driver for Microsoft's SQL Server has been checked in with the plug-in. You will need to install SQL Server and create a database yourself. If you are using the Express version of SQL Server and you created a database called "accounts" then the following values in the preferences should work:

driver: net.sourceforge.jtds.jdbc.Driver
subProtocol: jtds
subProtocolData: sqlserver://localhost/accounts;instance=SQLEXPRESS

Using JMoney with Other Databases

The plug-in should work with any database that supports JDBC though it has been tested only with HSQLDB and with SQL Server 2005. If you have problems with a particular database or driver and you need to make code changes, please let us know so we can add support for your database into the code base.

It may be worthwhile using the support for JDBC connection profiles provided as part of the Eclipse DTP project. This needs investigating.

Implementation Details

This plug-in will cache all commodity (currency) and account data in memory. Transactions and entries are read from the database on an as-needed basis. All changes to the database are made immediately.

If the database is changed externally to JMoney then the changes may or may not become visible in JMoney. If you close and re-open the database from within JMoney then you will always see all the external changes. Changes to commodities and accounts will not be visible until you close and re-open the database. Changes to account entries will become visible if you close and re-open just the view/editor.

Personal tools