When DB2 is installed, the required drivers are automatically installed. 
There are two ways of accessing the database: 
By accessing a local DB2 Client Application Enabler 
By accessing the DB2 server directly from a Java applet 
The same design and code can be used in both cases, provided the programmer 
is careful to parameterize the type of driver to load and the JDBC 
connection URL's. 
Using a local DB2 Client Application Enabler 
This approach requires that the platform on which the Java application will 
be run in a PC running Windows 95, NT or OS/2, or is some other platform on 
which the DB2 Client can be installed - in other words, a thick client. 
The required JDBC driver is located in the file \sqllib\java\db2java.zip 
(on a Net.Commerce system this will be \ibm\sqllib\java\db2java.zip), and 
this file must be included in the classpath environment variable. The 
driver can be loaded and registered with the JDBC driver manager with the 
line: 
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); 
This can be placed in a static initializer in the application. Systems 
running OS/2 should use the form 
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance(); 
Once this has been done, a database connection can be created: 
con = DriverManager.getConnection("jdbc:db2:databasename, userid, 
password); 
The JDBC URL will take the form "jdbc:db2:databasename" 
Access the DB2 Server Directly 
With this approach, the client platform can be a PC or similar platform 
running a browser, or it can be a Network Computer or similar thin client. 
The JDBC driver is a pure Java driver, and loads across the network from a 
web server running on the database server machine, in the case of an 
applet. 
The web server machine runs a JDBC server which accepts connections over 
TCP/IP. You start the JDBC server with the command "db2jstrt portno". The 
JDBC server, in turn, runs over the DB2 CLI (call level interface) which 
can be provided by either a DB2 client or server. In the Net.Commerce 
environment, the web server can be either running on the same machine as 
the DB2 database server, or it can be on a separate machine, in which case 
it will have the DB2 Client Application Enabler installed. Note that the 
security model imposed by the sandbox of the Java Virtual Machine means 
that a Java applet can basically only communicate with the server from 
which it was loaded, which means that the JDBC driver must be running on 
the same machine as the web server, rather than the database server. 
The JDBC driver can be loaded and registered with the JDBC driver manager 
with the line: 
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver"); 
or for OS/2 machines 
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver").newInstance(); 
In order for this to work, the JDBC driver must be downloadable from the 
web server. This can be achieved by placing the db2java.zip file on the web 
server, and using the archive= parameter of the APPLET HTML tag to specify 
its location. 
The JDBC URL will take the form "jdbc:db2://servername:port/databasename"