The ConnectionManager class

You use the ConnectionManager class to make a connection to a database, as described in Embedded SQLJ versus JDBC. The ConnectionManager class has two methods:
  • newConnection()
  • initContext()

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.