Hacking J-Bird (Version 0.5.2): Alternative Database Engines

You can use database engines other than the engine that is distributed with J-Bird (MckoiDB). Unfortunately, compatibility between engines is less than ideal. Not all engines implement SQL in the same manner, and not all JDBC drivers implement the entire standard. If you really want to pursue an alternative driver, you are in for an adventure that may be frustrating. Plan on compiling J-Bird for yourself and be willing to get into the guts of the code. A Number of engines have been tried with J-Bird. Some comments follow. Note that in the list below, only Postgres is likely to work.

To facilitate evaluation of drivers the class net.sourceforge.jbird.TestDB is under development. It is not packaged with the binary version of J-Bird, but it is part of the CVS tree. TestDB attempts to try JDBC classes and methods that are used with J-Bird as well as SQL. This is done in a very ad hoc manner and needs to be formalized. Use of Junit is under consideration.

Variation in SQL syntax among database engines is accommodated by using resources that are specific to particular database engines. Variable syntax is provided in a series of files called sql-name_of_driver in the J-Bird install directory. So far, use of these resources has been restricted to SQL create statements used by the database builder. It has not been necessary to support idiosyncrasies of SQL syntax in J-Bird itself, and use of resources has not yet been implemented in J-Bird. The need will undoubtedly arrive.

SQL resources work as follows. When the database builder starts, it looks for a serialized version of resources for the driver in use. If it finds serialized resources, it loads them. Otherwise, it loads and parses the non-serialized version and then saves a serialized version for future use. Serialized versions of SQL resources are stored in files named sql-ser-name_of_driver in the J-Bird directory.

Modify J-Bird.prefs to configure J-Bird and the database builder to use a particular database engine. Included in J-Bird.prefs are the driver class, database URL, username, and password. Sample J-Bird.prefs files are available in the CVS tree for a few drivers.

You are on your own for setting up database engines.

It is a good idea to place the jar file(s) for the JDBC driver somewhere in the J-Bird directory tree. Since J-Bird 0.4.1, the installer can dump the contents of the database to CSV files automatically before upgrades from J-Bird versions 0.4.0 or later. This will work with alternative database engines if the jar files (or symbolic links to them) are anywhere in the J-Bird directory tree. Also, the installer may also decide to rebuild the database from CSV values after the upgrade or to modify the database schema. It will be able to do these things if the JDBC drivers can be found in the J-Bird directory tree.

Previous (Remote accesss) Contents Next (Hacking - source from CVS)

SourceForge Logo

Page last updated 4 September 2004