Invalidating a session object
Finally, to invalidate the session instance, we use the invalidate method as
follows:
session.invalidate();
This may be required during logout processing.
3.5.3 Accessing DB2 via JDBC
The initial setup for a Java class to access DB2 using JDBC requires
importing the appropriate package, registering the DB2 driver, and creating
the connection to the DB2 database. This only needs to be done once.
After that, each SQL statement to be execute requires a statement to be
created, then executed, and finally closed.
Lastly, we give an example of what is required to write a Java servlet to
access a DB2 database using JDBC.
3.5.3.1 DB2 JDBC Drivers
DB2 JDBC main usages are for executing dynamic SQL statements and for
supporting upper data layers, such as SQLJ and IBM DataAccess beans.
DB2 provides two JDBC drivers: A native API Type 2 driver and a net protocol
Type 3 driver. The Java class libraries for both drivers are found in
db2java.zip.
  The native API driver is for server side applications that run on the
application server. The driver consists of Java parts and a C native API
interface (DB2 CLI). The driver translates JDBC calls into DB2 CLI calls. It
then gives the calls to the DB2 Client component, which passes them to
the DB2 Server. After that, the driver returns the result back to the
application. The class name for this JDBC driver is
COM.ibm.db2.jdbc.app.DB2Driver.
  The net protocol driver is for creating an application using the Java applet
model. The driver is a 100 percent Java program that is downloaded along
with the applet to the client browser. The driver exchanges messages, by
using the TCP socket protocol, to a JDBC Applet Server in the application
server machine. The JDBC Applet Server translates applet messages into
DB2 CLI calls. It sends the calls into the DB2 Client component, which
passes them to the DB2 Server. Then, the JDBC Applet Server passes the
results back to the applet. The class name for this JDBC driver is
COM.ibm.db2.jdbc.net.DB2Driver.
Chapter 3. Building the Web server
83




  

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