DB2 common command-line commands

Source: Internet
Author: User
Tags db2 db2 connect db2 connect to server port

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 )

    • Test Connection DB2

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: @

    • Login database:

$ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.