The DB2 Web Services samples use DB2 databases, stored procedures and XML extenders on your iSeries. The following provides information on configuring each of these.
Get started quickly with some of the samples by just creating the SAMPLES database.
Creating the SAMPLES Database
Many of the samples use the SAMPLES database on iSeries. You can create this database by either:
If you created the SAMPLE database from an interactive SQL session, you must authorize QEJBSVR to the database objects you just created in library SAMPLE. You can do this using the following two iSeries commands:
GRTOBJAUT OBJ(QSYS/SAMPLE) OBJTYPE(*LIB) USER(QEJBSVR) AUT(*ALL)
GRTOBJAUT OBJ(SAMPLE/*ALL) OBJTYPE(*ALL) USER(QEJBSVR) AUT(*ALL)
Run the Verification Test DB2 Web Service to see if the database was created correctly. If the database was successfully created, an XML document containing the current time should be displayed in your browser.
Creating the TRAVEL Database
Some of the examples use the TRAVEL database on iSeries. To create the travel database, from Qshell run the command setup_db from the following directory:
/instance_installedApps_root/DB2WebServicesSamples.ear/DB2Samples.war/WEB-INF/classes/groups/dxx_travel
where instance_installedApps_root is the directory applications are installed in for your application server instance. For example: /QIBM/UserData/WebASE/ASE5/myInstance/installedApps/myHost_myInstance
Before running samples that use the TRAVEL database on iSeries, you must authorize QEJBSVR to the database objects you just created in library DEMO. You can do this using the following two iSeries commands:
GRTOBJAUT OBJ(QSYS/DEMO) OBJTYPE(*LIB) USER(QEJBSVR) AUT(*ALL)
GRTOBJAUT OBJ(DEMO/*ALL) OBJTYPE(*ALL) USER(QEJBSVR) AUT(*ALL)
Run the Verification Test DB2 Web Service to see if the database was created correctly. If the database was successfully created, an XML document containing a short list of cities and their zip codes should be displayed in your browser
Configuring Stored Procedures
The samples defined by sample.dadx and Spserver.dadx make use of stored procedures. To define the sample stored procedures and catalog them in DB2, run the following iSeries commands from Qshell:
The stored procedures were created using the DB2 script Spcreate.db2. After you are done with the samples, you can use the Spdrop.db2 script to remove the stored procedure definitions
When using Java, stored procedures class files must be located in the directory /QIBM/UserData/OS400/SQLLib/Function (see step 3 above). You must authorize profile QEJBSVR to the class file copied. You can do this with the following iSeries command:
CHGAUT OBJ('/QIBM/UserData/OS400/SQLLib/Function/Spserver.class') USER(QEJBSVR) DTAAUT(*RWX) OBJAUT(*ALL)
After you have created the stored procedures in library SAMPLE using Spcreate.db2 (see step 2 above), you must authorize the profile QEJBSVR to these store procedures. You can do this with the following iSeries command:
GRTOBJAUT OBJ(SAMPLE/*ALL) OBJTYPE(*ALL) USER(QEJBSVR) AUT(*ALL)
Run the Verification Test DB2 Web Service to see if the database was created correctly. If the database was successfully created, an XML document containing the language that the stored procedure is implemented in should be displayed in your browser. Try invoking the service again, if you get the following error returned:
Error 400: java.lang.Exception: Connection error SQL system error.
Configuring XML Extenders
Some of the samples use XML extenders, which requires the XML extenders product to be installed.
Product Verification
You can verify that the product is already installed by using the CL command GO LICPGM on V5R2 to display the following:
5722DE1 *COMPATIBLE DB2 UDB Extenders
5722DE1 *COMPATIBLE DB2 UDB Text Extender
5722DE1 *COMPATIBLE DB2 UDB XML Extender
5722DE1 *COMPATIBLE Text Search Engine
Configuration
Before running the XML extenders samples, you must enable the XML extenders, using the CL command:
CALL PGM(QDBXM/QZXMADM) PARM(enable_db LOCALRDB)
where LOCALRDB is the *LOCAL database name in the RDB directory.
Use the CL command WRKRDBDIRE to work with the relational database (RDB) entries.