The JDBC Applet Server is a stand alone socket server application. To
activate the JDBC Applet Server, enter the following command:
db2jstrt 
This will activate the JDBC Applet Server listening on port . However,
we do not activate this function since the DB2 database is only accessed
through the WebSphere's servlet, not direct applet access.
3.5.3.2 Creating a JDBC program
To create a Java program that accesses DB2 using JDBC, we need to
perform the following steps.
Importing the java.sql package
Creating a Java program to access DB2 via JDBC requires the following
import:
import java.sql.*;
Registering the DB2 driver
We must then register the DB2 JDBC class. As mentioned in 3.5.3.1,  DB2
JDBC Drivers  on page 83, this can be one of two classes:
  COM.ibm.db2.jdbc.app.DB2Driver
Use this driver if the DB2 CAE is installed on the client machine.
  COM.ibm.db2.jdbc.net.DB2Driver
Use this driver if you do not wish to have the DB2 CAE installed on the
client machine.
The code to register the driver, assuming you would be using this Java class
with the native API driver, would be as follows:
try {
Class.forName( COM.ibm.db2.jdbc.app.DB2Driver );
} catch (Exception e) {
e.printStackTrace();
}
Creating the DB2 connection
A connection to the DB2 database is created with the getConnection method
from the DriverManager class. For example, to connect to the userstuf
database (we assume database userstuf has been cataloged correctly on this
server), with the default userid and password, we would use the call method
as follows:
String url= jdbc:db2:userstuf 
84
Linux Web Hosting with WebSphere, DB2, and Domino




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved