Application management
Use the Jython or Jacl scripting languages to manage applications with the wsadmin tool. Use the commands in the AppManagementCommands group can be used to display and process SQL Java (SQLJ) profiles or IBM Optim PureQuery Runtime bind files.
The AppManagementCommands command group for the AdminTask objectcommands include:
listSqljProfiles
Parse the EAR file of the specified application and returns a list of SQLJ files. SQLJ profiles have a .ser file name extension. If there are any files in the EAR file that are not SQLJ profiles, but have a .ser file name extension, those files can be listed also.Parameters and return values
- -appName
- The name of the installed application. The application must be installed before running customization and binding on it. Required.
Batch mode example usage:
- Use JACL:
$AdminTask listSqljProfiles {-appName application_name}
- Use Jython:
print AdminTask.listSqljProfiles('-appName application_name')
Interactive mode example usage:
- Use JACL:
$AdminTask listSqljProfiles -interactive
- Use Jython:
print AdminTask.listSqljProfiles('-interactive')
The output displays with syntax specific to the local operating system. The list of available profiles can be added to a group file, with a .grp extension, directly.
processSqljProfiles
Create a DB2 customization of the SQLJ profiles. The command optionally, by default, calls the SQLJ profile binder to bind the DB2 packages.
If we are processing a large enterprise application, or we are processing many SQLJ profiles, the process might take longer than the default timeout for the wsadmin tool. The default connection timeout for the wsadmin tool is set to 3 minutes. If the default timeout is reached and you lose the connection to the server, the wsadmin console issues a timeout statement. We can check the system output log for the final results of the customization and bind process and the amount of time for that the process. Do not start the processSqljProfiles command again until the previous command has completed, or the results might be unpredictable.
To prevent this disconnection, configure the session timeout to a longer time. See the system output log for the total processing time, and use that time period as a basis for the new timeout value. To extend the default timeout value, change the wsadmin properties file that corresponds to the connection type that we are using:
- For the SOAP connection type, change the following entry in the soap.client.props file:
com.ibm.SOAP.requestTimeout=180
- For JSR160RMI and RMI connection types, change the following entry in the sas.client.props file:
com.ibm.CORBA.requestTimeout=180
- For the IPC connection type, change the following entry in the ipc.client.props file:
com.ibm.IPC.requestTimeout=180
bprac
There are two ways we can verify if the binding or customization took place:
- If we performed a customization process, we can run a query from the command line to see the application EAR files that were changed:
wsadmin>print AdminConfig.hasChanges()
The query returns 0 if there are no changes, and 1 if changes occurred on the server. To view the configuration files that have unsaved changes, run:wsadmin>print AdminConfig.queryChanges()
.- View the System Out log to determine if the binding or processing was successful.
Target object: The installed application SQLJ profiles. These profiles are either single, serial .ser files or profiles that are grouped in a .grp group file. This target object is required.
Parameters and return values
- -appName
- The name of the installed application. The application must be installed before running customization and binding on it. This parameter is required.
- -classpath
- The path that tells the application server where to find the necessary SQLJ driver JAR files. Optional.
- -dburl
- The location of the DB2 server on the network. Optional.
- -user
- User name of the account performing the access to the DB2 database. Optional.
- -password
- Password for the account accessing the DB2 database. Optional.
- -options
- Additional options used with the db2sqljcustomize command might be inserted under the -options parameter except for the parameters listed previously. Optional. For additional information about the db2sqljcustomize command, consult db2sqljcustomize - SQLJ profile customizer.
- -profiles
- The location of the SQLJ profiles .ser files or .grp file. This parameter is required.
Batch mode example usage:
- Jacl:
$AdminTask processSqljProfiles {-appName FVT -classpath {C:/IBM/SQLLIB/java/db2jcc.jar } -url jdbc:db2://server.domain.ibm.com:50000/JTEST1 -user dbuser1 -password ***** -options "-rootpkgname MYPKG" -profiles {c:/temp/ApplicationSerNames.grp }}
- Jython:
AdminTask.processSqljProfiles('[-appName Application -classpath ["C:/IBM/SQLLIB/java/db2jcc.jar"] -dbURL "jdbc:db2://server.domain.ibm.com:50000/JTEST1" -user dbuser1 -password ***** -options [-rootpkgname MYPKG] -profiles ["c:/temp/ApplicationSerNames.grp"]]')
Interactive mode example usage:
wsadmin>print AdminTask.processSqljProfiles('-interactive')
Process serialized SQLJ profiles.
Process the serialized SQLJ profiles in an installed application.
Customize the profiles with run time information and bind static SQL packages in a database.
Refer to the Database SQLJ customize and bind documentation.
Do only bind processing. (bindOnly): false
*Application name. (appName): Application
Classpath to SQLJ tools. (classpath): C:/IBM/SQLLIB/java/db2jcc.jar
Database connection URL. (dbURL):
Database connection user name. (user):
Database connection password. (password):
Options for SQLJ tools. (options):
*SQLJ profile names. (profiles): c:/temp/ApplicationSerNames.grp
Process serialized SQLJ profiles. F (Finish) C (Cancel) Select [F, C]: [F]
WASX7278I:
Generated command line: AdminTask.processSqljProfiles('[-bindOnly false -appName Application -classpath [C:/IBM/SQLLIB/java/db2jcc.jar] -profiles [c:/temp/ApplicationSerNames.grp ]]')
listPureQueryBindFiles
Parse the EAR file of the specified application and returns a list of .bindprops and .pdqxml files that are found. PureQuery bind options files have a .bindprops file name extension. Bind files have a .pdqxml file name extension. If the EAR file contains files that are not pureQuery bind files, but have a .bindprops or a .pdqxml file name extension, those files can also be listed.Parameters and return values
- -appName
- The name of the installed application. Required.
Batch mode example usage:
- Use JACL:
$AdminTask listPureQueryBindFiles {-appName application_name}
- Jython:
print AdminTask.listPureQueryBindFiles('-appName application_name')
Interactive mode example usage:
- Use JACL:
$AdminTask listPureQueryBindFiles -interactive
- Jython:
print AdminTask.listPureQueryBindFiles('-interactive')
The output displays with syntax specific to the local operating system.
processPureQueryBindFiles
Invoke the DB2 pureQuery bind utility on a list of pureQuery bind files.
If we are processing a large enterprise application, or we are processing many pureQuery bind files using wsadmin, the process might take longer than the default timeout for the wsadmin tool. The default connection timeout for the wsadmin tool is set to 3 minutes. If the default timeout is reached and the process running on the server has not yet completed, the wsadmin console issues a timeout statement. We can check the system output log on the server for the final results of the bind process and the time when that process completed. Do not start the processPureQueryBindFiles command again until the previous command has completed, or the results might be unpredictable.
To prevent this timeout, configure the wsadmin request timeout to a longer time. After a successful customization and binding process, use the system output log to estimate the total processing time. Use this time period as a basis for the new timeout value. To extend the default timeout value, change the wsadmin properties file that corresponds to the connection type that we are using:
- For the SOAP connection type, change the following entry in the soap.client.props file:
com.ibm.SOAP.requestTimeout=180
- For JSR160RMI and RMI connection types, change the following entry in the sas.client.props file:
com.ibm.CORBA.requestTimeout=180
- For the IPC connection type, change the following entry in the ipc.client.props file:
com.ibm.IPC.requestTimeout=180
bprac
To verify whether the binding took place, view the System Out log to determine if the bind processing was successful.
Parameters and return values
- -appName
- The name of an installed application containing the pureQuery bind files to be processed. The application must be installed before running binding on it.
- -classpath
- A list of the paths to the Java archive (JAR) files that contain the IBM Optim PureQuery Runtime bind utility and its dependencies: pdq.jar, pdqmgmt.jar, db2jcc4.jar or db2jcc.jar, db2jcc_license_cisuz.jar or db2jcc_license_cu.jar. Use / or \\\\ as a file separator. Use a blank space to separate the paths for the JAR files.
- -dburl
- The URL for connecting to the database. The format is jdbc:db2://server:port/database_name.
- -user
- User name of the account performing the access to the DB2 database.
- -password
- Password for the account accessing the DB2 database.
- -options
- Any additional options needed by the IBM Optim PureQuery Runtime bind utility. Provide bind options as -bindoptions "bind_options_string". For additional information about the IBM Optim PureQuery Runtime bind utility, consult the topic about the pureQuery Bind utility.
- -files
- A list of the names of the pureQuery bind files to be processed. The bind file path names must be relative to the application EAR file containing them. Use / or \\\\ as a file separator. If we specify multiple profile paths, use a blank space to separate them.
Batch mode example usage:
- Jacl:
$AdminTask processPureQueryBindFiles { -appName MyApp -classpath {/pdq_home/pdq.jar /pdq_home/pdqmgmt.jar /db2_home/SQLLIB/java/db2jcc4.jar /db2_home/SQLLIB/java/db2jcc_license_cu.jar } -url jdbc:db2://hostname:50000/databasename -user dbuser1 -password dbpswrd1 -options {-bindoptions "BLOCKING NO"} -files {META-INF/xyz.bindprops META-INF/abc.bindprops } }Use Jython:
print AdminTask.processPureQueryBindFiles ( '[-appName MyApp -classpath [/pdq_home/pdq.jar /pdq_home/pdqmgmt.jar /db2_home/SQLLIB/java/db2jcc4.jar /db2_home/SQLLIB/java/db2jcc_license_cu.jar ] -url jdbc:db2://hostname:50000/databasename -user dbuser1 -password dbpswrd1 -options [-bindoptions "BLOCKING NO"] -files [META-INF/xyz.bindprops META-INF/abc.bindprops ]]' )
Interactive mode example usage:
print AdminTask.processPureQueryBindFiles('-interactive') Process pureQuery bind files.
Process the pureQuery bind files in an installed application.
Bind static SQL packages in a database.
Refer to the pureQuery Bind utility documentation.
*Application name. (appName): MyApp
Classpath to pureQuery Bind utility. (classpath): /pdq_home/pdq.jar /pdq_home/pdqmgmt.jar /db2_home/SQLLIB/java/db2jcc4.jar /db2_home/SQLLIB/java/db2jcc_license_cu.jar
*Database connection URL. (url): jdbc:db2://hostname:50000/databasename
Database connection user name. (user): dbuser1
Database connection password. (password): dbpswrd1
Options for the pureQuery Bind utility. (options): -bindoptions "BLOCKING NO"
*pureQuery bind file names. (files): META-INF/xyz.bindprops META-INF/abc.bindprops
Process pureQuery bind files. F (Finish) C (Cancel) Select [F, C]: [F]
WASX7278I: Generated command line: AdminTask.processPureQueryBindFiles('[-appName MyApp -classpath [/pdq_home/pdq.jar /pdq_home/pdqmgmt.jar /db2_home/SQLLIB/java/db2jcc4.jar /db2_home/SQLLIB/java/db2jcc_license_cu.jar ] -url jdbc:db2://hostname:50000/databasename -user dbuser1 -password ***** -options [-bindoptions "BLOCKING NO"] -files [META-INF/xyz.bindprops META-INF/abc.bindprops ]]')
Related:
Change the console session expiration wsadmin AdminTask Customize and binding profiles for Structured Query Language in Java (SQLJ) applications IBM Optim pureQuery Runtime Commands for the AdminTask object wsadmin scripting tool SQLJ profiles and pureQuery bind files settings