Command line processor start command
The command java com.ibm.db2.clp.db2 starts the DB2® command line processor.
>>-java--+-----------------------------------------------+--com.ibm.db2.clp.db2--+--------------+->< '--Ddb2.jcc.propertiesFile=java-properties-file-' '-option-flags-'
- java com.ibm.db2.clp.db2
- Starts the command line processor.
To simplify starting the command line processor, you can define an alias for this command, and then start the command line process by specifying the alias. For example:
alias db2="java com.ibm.db2.clp.db2" db2
- -Ddb2.jcc.propertiesFile=java-properties-file
- The command line processor runs under the IBM® Data Server Driver for JDBC and SQLJ. -Ddb2.jcc.propertiesFile=java-properties-file specifies the name of a file that contains configuration properties for the IBM Data Server Driver for JDBC and SQLJ. Specify this option only if your system administrator tells you to do so.
- option-flags
- Specifies one or more options for the command line processor. When you specify more than
one option, separate the option flags with spaces. To turn an option on, precede the option
flag with a minus (-) sign. To turn the option off, precede the option flag with a plus (+)
sign.
The following table lists the options and their default values, if the defaults have not been set by a command line processor properties file.
Table 1. Command line processor option flags Option flag Option description Default setting a Display the contents of the SQLCA after SQL statement execution. OFF c Automatically commit SQL statements. ON f file-name Read command input from the file specified by file-name. OFF o Display data and messages on the standard output device. ON s Stop the command line processor and exit to the operating system if an error occurs during execution of a statement or command. OFF t Use the semicolon (;) as the statement termination character. If this option is not set, the command line processor handles each line as a complete statement unless the line ends with a space followed by a backslash( \). OFF tdx Use x as the statement termination character. OFF v Echo the command text to the standard output device. OFF x Return data without any headers. OFF z file-name Store output data and messages in the file specified by file-name. OFF The values of any options that you do not specify are determined by the values in the properties file that is specified by the CLPPROPERTIESFILE environment variable.
Examples
- Example: Starting the DB2 command line processor with defaults
- Suppose that no alias has been set for the DB2 command line processor name. Use this command to start the command line processor with the default values:
java com.ibm.db2.clp.db2
- Example: Starting the DB2 command line processor with options
- Suppose that the alias db2 has been set for the DB2 command line processor name. You want to start the command line processor with these options, which are not the default options:
- After each SQL statement is executed, the contents of the SQLCA are displayed.
- COMMIT is not executed automatically after each SQL statement.
- The statement termination character is that pound sign (#).
db2 -a +c -td#
- Example: Starting the DB2 command line processor in batch mode
- Suppose that the alias db2 has been set for the DB2 command line processor name. You want to run the command line processor with these options:
- The DB2 command line processor runs in batch mode. File db2commands.clp contains the commands.
- The commands are echoed to the display.
Use this command:
db2 -f db2commands.clp -v