DB2 tip-customize the prompt of your DB2's console.

Source: Internet
Author: User

Tip 1. Specify the word in your DB2 console.

 

While you come in to DB2 console. the console will display the prompt in this system. the default word of DBS console's prompt is DB2 =>. as you see, it is very plain, and can not give our more information about the current connection. but DB2 Command provide a way to change it. the console's prompt can be protected by the option of DB2 system environment. the option is db2_clpprompt. the value of this option is not set, therefore the word is DB2 =>. you can set the value of its as you want. for example db2set db2_clpprompt = 'SQL =>', then you will find the prompt of console is changed after you run DB2 command. it likes this 'SQL => '. the value can use some variable character which is pre-defined into db2set command like '% d',' % I ',' % a' and '%'

 

The explanation about them is blow:

% I the instance's name if you connected, otherwise is null.

% Ia the instance's authid if you connected, otherwise is null.

% D the database's name if you connected, otherwise is null.

% Da the database's authid if you connected, otherwise is null.

 

Sample

[Db2inst1 @ dxzq10 ~] $ Db2set db2_clpprompt = 'SQL =>'

[Db2inst1 @ dxzq10 ~] $ DB2

SQL =>

 

[Db2inst1 @ dxzq10 ~] $ Db2set db2_clpprompt = '% d @ % I =>'

[Db2inst1 @ dxzq10 ~] $ DB2

@ Db2inst1 => --- you have never connect any database, therefore the name of database is not given.

@ Db2inst1 => list database directory;
 
System database directory
 
Number of entries in the directory = 1
 
Database 1 entry:
 
Database alias = toolsdb
Database Name = toolsdb
Local Database directory =/home/db2inst1
Database Release level = d.00
Comment =
Directory Entry type = indirect
Catalog Database Partition Number = 0
Alternate Server Hostname =
Alternate server port number =

@ Db2inst1 => connect to toolsdb;
 
Database connection information
 
Database Server = DB2/Linux 9.7.1
SQL authorization id = db2inst1
Local Database alias = toolsdb

Toolsdb @ db2inst1 =>

 

Now after you connect the toolsdb database. the prompt is changed to be toolsdb @ db2inst1, And the 'toolsdb' is the database's name, and 'db2inst1' is the instance's name.

 

That's all. Enjoy it.

 

 

 

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.