1 DB2 service Start-stop
Db2start
Db2stop
2 Setting up catalogs and aliases for client connections to remote DB
- Join a node on a customer
DB2 catalog TCPIP node Cibas remote host server port
Host--DB2 database IP address
PORT--DB2 Database Port
Cibas-- node name
- Joining a database in a node
DB2 Catalog Database Cibas ( db name ) as CIB3 ( alias ) at node Cibas ( Same as previous node )
DB2 Connect to CIB3 user database username using Database password
3 When you create or update a stored procedure on the DB2 command line, you need to use a special terminator, such as: @
$ DB2 [email protected]
DB2 = Connect to dbname user db2inst1 using [email protected]
- Execute stored procedure script, terminator using @
DB2 = DROP PROCEDURE [email protected]
DB2 = CREATE PROCEDURE Pro1 (in ID VARCHAR (10))
Language SQL
BEGIN
/** Program Body */
[Email protected]
When you execute a script, you know that this is the end of a statement, and it doesn't make any sense to the stored procedure itself, but you can also switch to other symbols in order to execute the script @,db2.
Or
- Connect the database First
- Issue a command:
DB2 [email protected]-VF CREATESQLPROC.DB2
The createsqlproc.db2 file is the SQL statement that creates the stored procedure, and the-TD option lets the command-line handler use @ as the statement terminating character; the-v option lets the command handler echo the command text back to standard output;-F lets the command-line handler read the command input from the specified file.
You can also direct the command line
DB2 [email protected] then enter your stored procedure SQL. The end @ will be executed.
DB2 common command-line commands