Error Reporting Functions

To simplify error reporting and handling, the DatabaseConfig class offers several useful methods.

For example, to send all your error messages to a particular message handler, first implement the handler:

package db.GettingStarted;

import com.sleepycat.db.Environment;
import com.sleepycat.db.MessageHandler;

public class MyMessageHandler implements MessageHandler  {

    // Our constructor does nothing
    public MyMessageHandler() {}

    public void message(Environment dbenv, String message)
        // Put your special message handling code here


And then set up your database to use the message handler by identifying it on the database's DatabaseConfig object:

package db.GettingStarted;

import com.sleepycat.db.DatabaseConfig;


DatabaseConfig myDbConfig = new DatabaseConfig();
MyMessageHandler mmh = new MyMessageHandler();