Tux on VM

Last updated on:
Sunday, July 06, 2008

Software

Information

Community

News

Fun

Credits




Valid HTML 4.01!
Linux for Big Iron
Title:
DB2Connect to Serve DB2 Data through JSP
Categories/Keywords:
database: db2, tomcat, jsp, connection, db2connect
Contributors:
"theborg" DT17459%THEBORG.bitnet@VM.MARIST.EDU
"Samy Rengasamy" snrsamy@yahoo.com
Write Up By:
"Samy Rengasamy" snrsamy@yahoo.com

A new project in our company required DB2 data on OS/390 to be served through JSP. We were already using DB2Connect Enterprise Edition, running at Solaris, to access DB2 on OS/390 for a different project. I knew about Tomcat as a Servlet Engine and JSP Server from a different project. I suggested this to our tech team and volunteered to get the environment setup on Linux/390. We are ultimately going to go production with this setup.

1. Installed JDK1.2 from BlackDown Site
2. Installed DB2Connect with default and admin instances from IBM DB2 UDB EE on Linux for S/390 and zSeries Version 7.2 (This link will require a registration)
3. Installed Tomcat 4.0.1 from the binary

After the above installs, I ran Tomcat in standalone mode and I tested the environment, it worked fine. I did get Apache and Tomcat work together using the mod_webapp connector from Apache. I had to build mod_webapp.so, as it is platform specific. I did follow these instructions. Here is the link to the mod_webapp.so in zipped version I built for our installation.

Snags:

I am running Tomcat under user 'jspsrvr'. The DB2 Catalog entries are under DB2 Instance db2inst1. I will have to access DB2 database with an OS/390 user id. I was not sure how to relate all these different access levels. I just posted the situation at Marist linux s/390 mailing list in following terms:

I have installed Tomcat and JDK under a user ID 'jspsrvr'. I have also installed DB2Connect Enterprise Edition to connect to DB2 on OS/390. I have a DB2 instance installed under user ID 'db2inst1'. I have made catalog definitions for the 'node', 'dcs' and 'database' under user ID 'db2inst1'.
I will have to access the DB2 with a MVS user id. When Tomcat runs under user ID 'jspsrvr', how to get the DB2Connect Services and Catalog definitions to be used by a jsp program with JDBC. I am able to use JDBC to access DB2 under user ID 'db2inst1'.

Got a reply from theborg:

In your tomcat.sh you will need to have it run the db2profile for that instance. For example add "source /home/users/db2admin/sqllib/db2profile" to the shell script. Then in the jdbc connection string for your JSP page you will need to provide a valid userid/password and URL to the MVS database.

I just followed his directions and it worked great.

 

Site hosting courtesy of Velocity Software