ClientInfo dynamic web project
In 5.5, “Configuring client information in WebSphere Application Server” on page 246, we use the ClientInfo dynamic web application for setting and verifying DB2 client information from a servlet application.
We used IBM Rational Application Developer for WebSphere Software for servlet development and tested the servlet functionality in WebSphere Application Server V8R5 on Windows and on z/OS. Upon successful servlet testing, we exported the ClientInfo dynamic web application and created the ClientInfo.war web archive file (WAR file). The WAR file includes the Java source and class files. You can download the ClientInfo.war file as described in Appendix I, “Additional material” on page 587.
In this appendix, we describe the ClientInfo dynamic web project, how to access the ClientInfo Java source files by using standard tools, and how to install the ClientInfo application in WebSphere Application Server.
This appendix covers the following topics:
H.1 The ClientInfo dynamic web project
The ClientInfo application consists of the servlets that are shown in Table H-1, with each servlet using a different interface for setting DB2 client information:
Table H-1 ClientInfo servlet functionality
Servlet name
Interface that is used for setting the DB2 client information
ClientInfoJDBC30API
com.ibm.db2.jcc.DB2Connection class interfaces:
setDB2ClientUser
setDB2ClientWorkstation
setDB2ClientApplicationInformation
setDB2ClientAccountingInformation
The DB2Connection interfaces are started directly through the com.ibm.websphere.rsadapter.WSCallHelper.jdbcCall interface.
ClientInfoJDBC40API
java.sql.Connection class setClientInfo interface
ClientInfoWSAPI
com.ibm.websphere.rsadapter.WSConnection class setClientInformation interface
ClientInfoWLM
SQL CALL SYSPROC.WLM_SET_CLIENT_INFO stored procedure
If you use the Java EE perspective of Rational Application Developer for WebSphere Software, the structure of the ClientInfo dynamic web project with its Java source files looks like the structure that is shown in Figure H-1.
Figure H-1 ClientInfo project that is shown in the Java EE perspective
H.2 Accessing the ClientInfo.war file from your workstation
After the WAR file is downloaded to your workstation, you can access its content by using standard tools that can process archive files (see Figure H-2).
Figure H-2 Opening the ClientInfo.war file
H.3 Installing the ClientInfo web application
To install the ClientInfo dynamic web application, you must log in to the WebSphere Integrated Solution Console (ISC) to complete the following tasks:
1. To define JDBC providers, follow the instructions that are provided in 5.2.1, “Defining a DB2 JDBC XA provider” on page 210 and 5.3.1, “Defining a DB2 JDBC provider” on page 223. If a JDBC provider exists, you do not need to perform this task.
2. To define a data source to access your DB2 server using JDBC type 2, follow the instructions that are provided in 5.2.3, “Defining a JDBC type 4 XA data source” on page 218; for the definition of JDBC type 4, follow the instructions in 5.3.3, “Defining a JDBC type 2 data source” on page 233. For the ClientInfo application to function, the JNDI name of the data source must be jdbc/Josef.
3. To select the ClientInfo.war file for installation, click Applications → New Applications → Enterprise Applications, select Local file system, and click Next, as shown in Figure H-3.
Figure H-3 Install ClientInfo application from local file system
4. Select Fast Path and click Next, as shown in Figure H-4.
Figure H-4 How to install the application
5. The Step 1: Select installation options window opens (Figure H-5). Leave the options at their defaults and select Next.
Figure H-5 Step 1: Select installation options window
6. The Step 2: Map modules to servers window opens (Figure H-6). Choose the server that you want to install the application in and click Next.
Figure H-6 Step 2: Map modules to servers window
7. The Step 3: Map context roots for Web modules window opens (Figure H-7). Enter the /ClientInfo context root name and click Next.
Figure H-7 Step 3: Map context roots for Web modules window
8. The Step 4: Metadata for modules window opens (Figure H-8). Leave the options at their defaults and click Next.
Figure H-8 Step 4: Metadata for modules window
9. The Step 5: Summary window opens (Figure H-9). Click Finish.
Figure H-9 Step 5: Summary window
10. A window opens and shows a successful application installation (Figure H-10).
Click Review.
Figure H-10 Application Clientinfo_war installed successfully
11. In the New Application window that opens (Figure H-11), click Synchronize changes with Nodes and click Save.
Figure H-11 Synchronize changes with nodes
12. You have successfully installed the ClientInfo application, as shown in Figure H-12. Click OK to continue.
Figure H-12 ClientInfo application installed successfully
H.4 Starting the ClientInfo web application
To start the ClientInfo web application, complete the following steps:
1. Click All applications, check the ClientInfo_war check box, and click Submit Action, as shown in Figure H-13.
Figure H-13 Panel 1 starting the ClientInfo Application
2. Upon successful completion, ISC confirms a successful start of the application by displaying a green arrow in the application status column. The job log of the servant region shows the runtime messages that are listed in Figure H-14 to confirm successful application start.
BBOO0222I: ADMN1008I: An attempt is made to start the ClientInfo_war 330
application. (User ID =
wtsc64.itso.ibm.com/server:mzcell_mznode4_MZSR015)
BBOO0222I: WSVR0190I: Starting composition unit 331
WebSphere:cuname=ClientInfo_war in BLA
WebSphere:blaname=ClientInfo_war.
BBOO0222I: WSVR0200I: Starting application: ClientInfo_war
BBOO0222I: WSVR0204I: Application: ClientInfo_war Application build 333
level: Unknown
BBOO0222I: WSVR0221I: Application started: ClientInfo_war
BBOO0222I: WSVR0191I: Composition unit WebSphere:cuname=ClientInfo_war 335
in BLA WebSphere:blaname=ClientInfo_war started.
Figure H-14 Servant region application start messages
H.5 Testing the ClientInfo web application
After you start the ClientInfo application successfully, you can enter the URLs shown in Table H-2 to start the servlet applications from your browser.
Table H-2 URLs for testing the ClientInfo servlet applications
Servlet name
URL
ClientInfoJDBC30API
http://<server>:<portno>/ClientInfo/JDBC30API
ClientInfoJDBC40API
http://<server>:<portno>/ClientInfo/JDBC40API
ClientInfoWSAPI
http://<server>:<portno>/ClientInfo/WSAPI
ClientInfoWLM
http://<server>:<portno>/ClientInfo/WLM
H.6 Testing the ClientInfoJDBC30API servlet
Upon successful ClientInfoJDBC30API servlet start, you receive the output that is shown in Figure H-15.
Figure H-15 Testing the ClientInfoJDBC30API servlet
For a description about the result that is returned by the ClientInfoJDBC30 servlet, see 5.5.3, “Setting DB2 client information in a WebSphere Java application” on page 255.
H.7 Testing the ClientInfoJDBC40 servlet
Upon successful ClientInfoJDBC40API servlet start, you receive the output that is shown in Figure H-16 on page 583.
Figure H-16 Testing the ClientInfoJDBC40API servlet
For a description about the result that is returned by the ClientInfoJDBC40 servlet, see 5.5.3, “Setting DB2 client information in a WebSphere Java application” on page 255.
H.7.1 Common pitfalls when using the JDBC 4.0 setClientInfo API
During our testing of ClientInfoJDBC40API, we received the error message that is shown in Figure H-17, which indicates that the JDBC 4.0 java.sql.Connection.setClientInfo API was not supported by the application server runtime environment, even though the JDBC provider we were using explicitly had the db2jcc4.jar file in its class path.
java.sql.SQLFeatureNotSupportedException: DSRA1300E: Feature is not implemented: Connection.setClientInfo
at com.ibm.ws.rsadapter.AdapterUtil.notSupportedX(AdapterUtil.java:1460)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.setClientInfo(WSJdbcConnection.java:5101)
 
Figure H-17 setClientInfo SQLFeatureNotSupportedException
Further analysis of the application server environment showed that we had several JDBC providers defined, some with db2jcc4.jar and some with db2jcc.jar in their class path. After we changed the JDBC procedures to use only the db2jcc4.jar file, the problem was resolved and the ClientInfoJDBC40API servlet ran successfully.
H.8 Testing the ClientInfoWSAPI servlet
Upon successful ClientInfoWSAPI servlet start, you receive the browser output that is shown in Figure H-18.
Figure H-18 Testing the ClientInfoWSAPI servlet
For a description about the result that is returned by the ClientInfoWSAPI servlet, see 5.5.3, “Setting DB2 client information in a WebSphere Java application” on page 255.
H.9 Testing the ClientInfoWLM servlet
Upon successful ClientInfoWLM servlet start, you receive the browser output that is shown in Figure H-19.
Figure H-19 Testing the ClientInfoWLM servlet
For a description about the result that is returned by the ClientInfoWLM servlet, see 5.5.3, “Setting DB2 client information in a WebSphere Java application” on page 255.
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset