4.1 Loading the Advanced Server JDBC Connector

Table of Contents Previous Next


4 Using the Advanced Server JDBC Connector with Java applications : 4.1 Loading the Advanced Server JDBC Connector

The Advanced Server JDBC driver is written in Java and is distributed in the form of a compiled JAR (Java Archive) file. Use the Class forName() method to load the driver. The forName() method dynamically loads a Java class at runtime. When an application calls the forName() method, the JVM (Java Virtual Machine) attempts to find the compiled form (the bytecode) that implements the requested class.
After loading the bytecode for the driver, the driver registers itself with another JDBC class (named DriverManager) that is responsible for managing all the JDBC drivers installed on the current system.
If the JVM is unable to locate the named driver, it throws a ClassNotFound exception (which is intercepted with a catch block near the end of the program). The DriverManager is designed to handle multiple JDBC driver objects. You can write a Java application that connects to more than one database system via JDBC. The next section explains how to select a specific driver.

4 Using the Advanced Server JDBC Connector with Java applications : 4.1 Loading the Advanced Server JDBC Connector

Table of Contents Previous Next