Sample web application using JSF that uses JDBC DataSource to read and update the sample Db2 EMP table.
projects/
- Eclipse web project and CICS bundle project suitable for importing into a CICS Explorer or z/OS Explorer environment.etc/
- Liberty server configuration files and CICS RDO DFHCSDUP input.
employee.jdbc.web
- Dynamic web projectemployee.jdbc.cicsbundle
- CICS bundle project
- CICS TS V5.3 with APAR PI77502 for Java EE 7
- Java SE 1.8 or later on the workstation
- Eclipse with the IBM CICS SDK for Java EE, Jakarta EE and Liberty installed available here
- IBM Db2 for z/OS
The sample code can be deployed as a WAR file into a CICS Liberty JVM server. CICS Liberty can be configured to use either a local Db2 database with JDBC type 2 connectivity, or a remote database with a JDBC type 4 connectivity.
- Import the projects into CICS Explorer using File -> Import -> General -> Existing projects into workspace
- Resolve the build path errors on the Dynamic web project using the following menu from the web project: Build Path -> Configure Build Path -> Libraries -> Add Library -> CICS with Java EE and Liberty and select the version of CICS TS for deployment (either CICS TS V5.3 or CICS TS V5.4)
- Export the web project
- Update the CICS STEPLIB with the Db2 SDSNLOAD and SDSNLOD2 libraries
- Configure CICS URIMAP, DB2CONN, DB2TRAN and DB2ENTRY resource definitions as described in How you can define the CICS DB2 connection
- Bind the Db2 plan that is specified in the CICS DB2CONN or DB2ENTRY definition with a PKLIST of NULLID.*
- Create a Liberty JVM server called DFHWLP as described in 4 easy steps
- Add the following Liberty features to the
featureManger
list in server.xml:jsf-2.2
,jndi-1.0
,jdbc-4.1
- Add a library definition to the Liberty server.xml that references the Db2 JCC libraries
- Add a data source definition to the Liberty server.xml, a template server.xml is provided in type-2-server.xml
- Create a Liberty JVM server called DFHWLP as described in 4 easy steps
- Add the following Liberty features to the
featureManger
list in server.xml:jsf-2.2
,jndi-1.0
,jdbc-4.1
- Add a library definition to the Liberty server.xml that references the Db2 JCC libraries
- Add a data source definition to the Liberty server.xml, a template server.xml is provided in type-4-server.xml
To deploy the sample you will need to import the projects into Eclipse.
To install the sample as a CICS bundle:
- Export the CICS bundle project employee.jdbc.cicsbundle from Eclipse using the menu Export Bundle Project to z/OS UNIX File System.
- Define and install a CICS BUNDLE defintion that references the zFS directory from step 1.
To install the sample through Liberty configuration:
- Export the dynamic Web project employee.jdbc.web from Eclipse using the menu File > Export > WAR file > Finish.
- Copy the exported WAR file in binary to zFS.
- Add an application element to the Liberty server.xml configuration file that refernces the WAR file using employee.xml as a basis.
To define the DB2LOG CICS temporary storage queue as recoverable, you will need to create a CICS TSMODEL resource definition with the Recovery
attribute set to Yes
.
A sample DFHCSDUP input file is provided in DFHCSD.txt
The application is accessed with the following URL: http://host:port/employee.jdbc.web/ and allows the user to perform create, read, update and delete operations on employees listed in the Db2 EMP table. Further details on how to use the sample to connect to Db2 by using JDBC can be found in chapter 4 of the IBM Redbook Liberty in IBM CICS: Deploying and Managing Java EE Applications, SG248418
- CICS Knowledge Center Configuring a Liberty JVM server
- CICS Knowledge Center Configuring a JVM server to support DB2
- IBM Redbook Liberty in IBM CICS: Deploying and Managing Java EE Applications
This project is licensed under Apache License Version 2.0.