This document explains how to enable JAMES to use a database to store mail messages for spools, user accounts, and other usages.
Obtain a suitable JDBC driver for a suitable vendor. A non-production grade JDBC-ODBC is included in the JDK, and many commercial and free drivers are available. See http://java.sun.com/products/jdbc/drivers/ for a list of suitable drivers. JAMES uses the Town library (http://www.working-dogs.com/town/) to access a database, and you can use any JDBC 1.X or greater compliant database driver. Town also handles connection pooling.
Note that as JAMES will repeatedly send large amounts of text and binary across this driver, we recommend production grade drivers whenever possible.
In the var directory of the JAMES distribution, you will find several sample database connection definition files. These are sample Properties files that define the necessary information to connect to a database. You may either rename one of these to maildatabase, or you may create your own database connection definition file. Important properties to set are the driver classname, the JDBC URL, and the username and password.
JAMES expects to use a table named "Message" in whatever database you've specified. Sample SQL scripts to create this table in SQL Server and MySQL are available in this docs directory. If you are using another database, you can hopefully see the necessary structure and can create it for your database. Please submit these to us! (we'll include them in future distributions)
After the bootstrap startup, when you edit the JAMES.conf.xml file, you will see several places that specify a mail or spool repository. Commented out next to several of these entries are alternate settings to use the database connection definition defined above.
The format of the URL to use the database mail or spool repository is town://<repositoryname>@<conndef-filename> The alternate settings for the database repository expect the filename to be maildatabase, which is why above we recommended you rename it.
In the bin directory where run.bat and run.sh (or whatever directory you were in when you started JAMES), you should see a file named something like DCB_970616938320.log. If this file does not exist, JAMES was unable to find the connection definition file or it was unable to find the database driver.
Open this file, and you will see the server's attempt to connect to the server. If successful, you will see the log shows one or two open connections were established. If you are seeing repeated attempts to reconnect to the database, either the JDBC URL is incorrect, or the username and password are incorrect.
Copyright (c) 1997-2000 The
Java Apache Project.
All rights reserved.