Skip to content

Sample web application that uses JDBC to read and update the sample Db2 EMP table.

License

Notifications You must be signed in to change notification settings

cicsdev/cics-java-liberty-employee-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cics-java-liberty-employee-db

Sample web application using JSF that uses JDBC DataSource to read and update the sample Db2 EMP table.

Repository structure

  • 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.

Project overview

Pre-requisites

  • 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

Configuration

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.

To import the samples into Eclipse

  1. Import the projects into CICS Explorer using File -> Import -> General -> Existing projects into workspace
  2. 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)
  3. Export the web project

To configure CICS Liberty for JDBC type 2 connectivity

  1. Update the CICS STEPLIB with the Db2 SDSNLOAD and SDSNLOD2 libraries
  2. Configure CICS URIMAP, DB2CONN, DB2TRAN and DB2ENTRY resource definitions as described in How you can define the CICS DB2 connection
  3. Bind the Db2 plan that is specified in the CICS DB2CONN or DB2ENTRY definition with a PKLIST of NULLID.*
  4. Create a Liberty JVM server called DFHWLP as described in 4 easy steps
  5. Add the following Liberty features to the featureManger list in server.xml: jsf-2.2, jndi-1.0, jdbc-4.1
  6. Add a library definition to the Liberty server.xml that references the Db2 JCC libraries
  7. Add a data source definition to the Liberty server.xml, a template server.xml is provided in type-2-server.xml

To configure CICS Liberty for JDBC type 4 connectivity to Db2

  1. Create a Liberty JVM server called DFHWLP as described in 4 easy steps
  2. Add the following Liberty features to the featureManger list in server.xml: jsf-2.2, jndi-1.0, jdbc-4.1
  3. Add a library definition to the Liberty server.xml that references the Db2 JCC libraries
  4. Add a data source definition to the Liberty server.xml, a template server.xml is provided in type-4-server.xml

Deploying the sample

To deploy the sample you will need to import the projects into Eclipse.

To install the sample as a CICS bundle:

  1. Export the CICS bundle project employee.jdbc.cicsbundle from Eclipse using the menu Export Bundle Project to z/OS UNIX File System.
  2. Define and install a CICS BUNDLE defintion that references the zFS directory from step 1.

To install the sample through Liberty configuration:

  1. Export the dynamic Web project employee.jdbc.web from Eclipse using the menu File > Export > WAR file > Finish.
  2. Copy the exported WAR file in binary to zFS.
  3. 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

Running the sample

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

Reference

License

This project is licensed under Apache License Version 2.0.

About

Sample web application that uses JDBC to read and update the sample Db2 EMP table.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published