16.10.2015 Views

Getting Started with WebSphere Application Server

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

68 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> Community Edition<br />

Type 2<br />

and<br />

Type 4<br />

IBM Data <strong>Server</strong> Driver<br />

for JDBC and SQLJ<br />

Table 4.1 - DB2 JDBC and SQLJ drivers<br />

db2jcc.jar<br />

and sqlj.zip<br />

db2jcc4.jar<br />

and<br />

sqlj4.zip<br />

* Deprecated means it is still supported, but no longer enhanced<br />

JDBC 3.0<br />

compliant<br />

JDBC 4.0 and<br />

earlier<br />

1.4.2<br />

6<br />

As you can see from Table 4.1, Type 2 is provided <strong>with</strong> two different drivers; however the<br />

DB2 JDBC Type 2 Driver for Linux, UNIX and Windows, packaged as db2java.zip, is<br />

deprecated.<br />

The IBM Data <strong>Server</strong> Driver for JDBC and SQLJ packaged as db2jcc.jar<br />

(com.ibm.db2.jcc) includes support for both, the type 2 and type 4 drivers. The choice of<br />

driver is determined based on the syntax used to connect to the database in your Java<br />

program: If a hostname or IP address, and a port are included in the connection string,<br />

then type 4 is used, otherwise, type 2 is used. The IBM Data <strong>Server</strong> Driver for JDBC and<br />

SQLJ has been optimized to access all DB2 servers in all platforms including the<br />

mainframe.<br />

When you install a DB2 server, a DB2 client or the IBM Data <strong>Server</strong> Driver for JDBC and<br />

SQLJ, the db2jcc.jar and sqlj.zip files compliant <strong>with</strong> JDBC 3.0 are automatically<br />

added to your CLASSPATH. If you would like to use the JDBC 4.0 specification, make sure<br />

to replace db2jcc.jar and sqlj.zip <strong>with</strong> db2jcc4.jar and sqlj4.zip respectively<br />

in the CLASSPATH.<br />

Note:<br />

For more information about JDBC drivers, refer to the eBook <strong>Getting</strong> started <strong>with</strong> DB2<br />

Express-C. If you are new to the Java programming language and the Java EE framework,<br />

review the eBook <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> Java. Both books are part of this book series.<br />

In this book we use the JDBC 4 compliant driver packaged in file db2jcc4.jar that is<br />

included <strong>with</strong> DB2 Express-C under C:\Program Files\IBM\SQLLIB\Java on<br />

Windows or /opt/ibm/db2/V9.7/java on Linux. Note that db2jcc4.jar requires Java 6.<br />

To install the JDBC driver in Community Edition follow these steps:<br />

1. Start the Community Edition server if it is not started yet. Open a browser and log<br />

in to the Administrative Console using the user ID of system and the password of<br />

manager: https://localhost:8443/console<br />

2. In the Console Navigation section on the left panel, under the Services folder, click<br />

on Repository to open the repository viewer portlet as shown in Figure 4.3.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!