Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

db2c help

abukhait edited this page Feb 3, 2012 · 3 revisions

db2c(1) - A DB2 console with with history and autocomplete support, and few other goodies

SYNOPSIS

db2c [options] [dbname]

DESCRIPTION && EXAMPLES

DB2 console mode does not support readline and autocomplete, this is a wrapper for the db2 command with support for both.

  • History:

    db2 => connect to testdb (or: db2 => use testdb)
    db2(testdb) => current date
    db2(testdb) => -107
    (Use the arrows for history, you can also use -r to search the history)
    db2(testdb) => history
    (To see a list of all saved history lines)
    
  • Autocomplete:

    db2(testdb) => sel[double-tab]
    it remembers..
    db2(testdb) => list tables for schema xyz
    db2(testdb) => select * from xyz.tab[double-tab]
    
  • You can edit last statement or use the editor to write a new multiline statement:

    db2(testdb) => edit
    db2(testdb) => emacs
    
  • Any !command will be sent to the shell as is:

    db2(testdb) => !clear
    
  • You can use some common shell commands directly:

    db2(testdb) => ls ~
    db2(testdb) => less ~/somefile
    db2(testdb) => top
    db2(testdb) => irb
    
  • You can use some psql-like meta commands

    db2(testdb) => **\h**
      == To see this help from within the console
    db2(testdb) => **\l**
      == list database directory
    db2(testdb) => **\lt [all|schema]**
      == list tables for all or one schema using db2 list command
    db2(testdb) => **\l[t|v|a|s] [schema]**
      == list tables|views|aliases|summary-tables for all or one schema using syscat.tables
    db2(testdb) => **\d schema.table**
      == describe table schema.table
    db2(testdb) => **\q**
    
  • You can pipe:

    db2(testdb) => \dv | grep -v SYS
    db2(testdb) => select * from large.table | less
    
  • For example, if a command outputs long lines, less -S is your friend:

    db2(testdb) => select * from table.with.many.columns | less -S
    (you can scorll horizontally with left/right arrows)
    

OPTIONS

  • -h, --help, --man: Displays this help page.

  • -t: Commands will be executed when you enter a terminating semicolon (;)

  • --debug: Displays annoying messages.

  • --no-rlrwap: Don't use rlwrap