Home | Previous Page | Next Page   Appendix A. Connecting to Databases >

The ConnectionManager Class

You use the ConnectionManager class to make a connection to a database, as described in Connecting to a Database. The ConnectionManager class has two methods:

The newConnection() method creates and returns a new JDBC Connection object using the current values of the DRIVER, DBURL, UID, and PWD attributes. If any of the needed attributes is null or a connection cannot be established, an error message is printed to System.out, and the program exits.

The initContext() method returns the currently installed default context. If the current default context is null, a new default context instance is created and installed using a connection obtained from a call to getConnection.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]