5.6.3 Java applications

Table 5-9lists the Java applications. All Java applications are packaged into the Java archive itso.jar. When starting a Java application, we have to make sure that

all used classes are available to the runtime. This is done by setting up the classpath. We must therefore add itso.jar to the classpath. The DDLExecuter and

the MigrateExecuter connect to DB2 from Java, so for these applications we add also add db2jcc.jar and db2jcc_license_cu.jar to the classpath.

The Java applications will exit with one of the following codes:

￿0: If execution was successful.

￿1: If wrong number of arguments were passed to the application.

￿2: If any error occurred during execution.

Table 5-9 Java applications

Application name

Description

 

 

ScriptExecuter

Execute a script file. The name of the script file must be passed

 

as argument to the application.

 

 

DDLExecuter

Execute a file containing DDL and/or SQL statements. It

 

connects to the database given as argument and executes all

 

the statements in the file in one transaction. That is, if one

 

statement fail, all the statements are rolled back. The application

 

require 3 or 5 arguments:

 

￿ server:port or server. Server name and optional port

 

number for the DB2 server.

 

￿ alias. The name of the database to be conncted to.

 

￿ filename. The name of the file containing the statements.

 

￿ userid. The name of the user used to connect to DB2.

 

￿ password. The password for the user used to connect to

 

DB2.

 

user ID and password are optional, but must either both be

 

omitted or both supplied. Example:

 

localhost itsodb populate.sql db2inst1 db2inst1

 

 

Chapter 5. Deploying pre-configured databases

255

Page 269
Image 269
IBM DB2 manual Java applications, 255