174 iSeries Access for Web V5R2 and WebSphere Host Publisher V4.0
The SQL statement types are:
Select
Select Unique
Insert
Update
Delete
After Database Access guides you through creating an Integration Object, use the Application
Integrator application to create a Web page where the data will appear.
6.4.2 Sample scenario
The Host Publisher Studio Database Access allows you to connect to a database to create
and generate a database Integration Object. It is also used to define the database connection
and connection pools if required by your application.
This section shows you a sample scenario in which we connect to the DB2 UDB for iSeries
database provided by iSeries. We choose in the IBM WebSphere Host Publisher Studio the
IBM Toolbox for Java JDBC Driver, from the pull-down menu, to access to the DB2 UDB for
iSeries database. This driver, com.ibm.as400.access.AS400JDBCDriver, has to be known at
the classpath from your PC. If you dont have it already on your PC, copy it from your iSeries.
You can find it in the directory /QIBM/ProdData/OS400/jt400/lib/. The JAR file is called
jt400Native.jar.
Step 1: Connecting to the database
Before you attempt to create the database Integration Object, you are required to connect to
the database. After you start Studio Database Access, you enter the required information to
establish this connection, as shown in Figure 6-31.
Database URL
Specify the JDBC URL for the database. The format of the database URL depends on the
JDBC driver you use to connect to the database.
If you select one of the JDBC drivers from the drop-down list in the Driver field, the required
format for the driver is displayed in the Database URL field. For example, the AS/400 (IBM)
Toolbox for Java JDBC driver requires jdbc:as400://
host
, where
host
is the fully-qualified
network name of the database host.
The connection is specified with a URL format, for example:
jdbc:subprotocol:subname
Note the following explanation:
subprotocol
is the driver name (for example, as400, db2, oracle, odbc, and so forth).
subname
is the system name, default schema, and properties (for example
jdbc:as400://systemName/defaultSchema;listOfProperties)
Note: When a database query (such as select) is made and the field is empty, the
database returns a value of null. As a result, the Host Publisher database Integration
Object returns a value of null to the invoker. By default, JSP pages generated in Application
Integrator display null values as null not as a string of blanks. If you prefer that null
values appear as blanks, you need to modify the JSP pages so that the null values are
displayed as blanks.
Chapter 6. Using Host Publisher Studio to develop J2EE applications 175
The format of the database URL depends on the JDBC driver you use to connect to the
database. If you select Other from the drop-down list in the Driver field, consult your JDBC
driver documentation for the required format of the database URL.
Figure 6-31 Database Access: Connecting to the database
User ID
Type the user ID, if one is required, for the specified database to which you intend to connect.
Password
Type the password, if one is required, for the specified database.
Driver
Select the JDBC driver used to connect to the specified database from the drop-down list, or
select Other. If you select Other, enter the class name of your driver in the Other driver field.
Other driver
When you select a JDBC driver from the Driver drop-down list, this field displays the class
name associated with the driver. If you select Other from the drop-down list in the Driver field,
enter the class name of your driver in the Other driver field.
Note: For more information about the JDBC or JDBC Properties, see the iSeries
Information Center Web site at:
http://publib.boulder.ibm.com/pubs/html/as400/
When you reach the site, select your release and search for JDBC or IBM Toolbox for
Java JDBC properties.

Get iSeries Access for Web V5R2 and WebSphere Host Publisher V4.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.