Problem in V8 : db2 ? command

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pascal Deparis

    Problem in V8 : db2 ? command

    Hi,

    I've got a problem with the DB2 Command Line Processor, in V8, FP1. The
    databases have been created on an AIX server (version 4.3.3).
    Have a look at this:

    [db2inst8@mymach ine][/db2users/db2inst8]>db2 ? list
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL1024N A database connection does not exist. SQLSTATE=08003
    [db2inst8@mymach ine][/db2users/db2inst8]>cd sqllib
    [db2inst8@mymach ine][/db2users/db2inst8/sqllib]>db2 ? list
    LIST ACTIVE DATABASES [AT DBPARTITIONNUM db-partition-number | GLOBAL]

    LIST APPLICATIONS [FOR DATABASE database-alias]
    [AT DBPARTITIONNUM db-partition-number| GLOBAL] [SHOW DETAIL]

    LIST COMMAND OPTIONS

    LIST DATABASE DIRECTORY [ON path]

    LIST DATABASE PARTITION GROUPS [SHOW DETAIL]

    LIST DATALINKS MANAGERS FOR DATABASE database-name

    LIST DBPARTITIONNUMS

    LIST DCS APPLICATIONS [SHOW DETAIL | EXTENDED]

    LIST DCS DIRECTORY

    LIST DRDA INDOUBT TRANSACTIONS [WITH PROMPTING]

    LIST HISTORY {BACKUP | ROLLFORWARD | REORG |
    CREATE TABLESPACE | ALTER TABLESPACE | DROPPED TABLE | LOAD |
    RENAME TABLESPACE | ARCHIVE LOG}
    {ALL | SINCE timestamp |CONTAINING {schema.object_ name | object_name}}
    FOR [DATABASE] database-alias

    LIST INDOUBT TRANSACTIONS [WITH PROMPTING]

    LIST [ADMIN] NODE DIRECTORY [SHOW DETAIL]

    LIST PACKAGES [FOR {USER | ALL | SYSTEM | SCHEMA schema-name}] [SHOW DETAIL]

    LIST TABLES [FOR {USER | ALL | SYSTEM | SCHEMA schema-name}] [SHOW DETAIL]

    LIST TABLESPACE CONTAINERS FOR tablespace-id [SHOW DETAIL]

    LIST TABLESPACES [SHOW DETAIL]

    NOTE: From the operating system prompt, prefix commands with 'db2'.
    Special characters MAY require an escape sequence (\), for example:
    db2 \? change database
    db2 ? change database xxx comment with \"text\"


    This problem doesn't exist on another machine, with the same DB2 version and
    Fixpack. Moreover, the db2profiles and .profile files on the instances are
    the same.
    Why should I connect to a database, or why does it work when I change my
    current directory, to get the help message?
    Could you help me please?

    Here is the result of the db2level command :
    [db2inst8@mymach ine][/db2users/db2inst8/sqllib]>db2level
    DB21085I Instance "db2inst8" uses "32" bits and DB2 code release "SQL08010"
    with level identifier "01010106".
    Informational tokens are "DB2 v8.1.0.8", "s030130", "U486245", and FixPak
    "1".
    Product is installed at "/usr/opt/db2_08_01".


    Thanks,

    Pascal.


  • Knut Stolze

    #2
    Re: Problem in V8 : db2 ? command

    Pascal Deparis <pdeparis@partn er.auchan.com> wrote:
    [color=blue]
    > Hi,
    >
    > I've got a problem with the DB2 Command Line Processor, in V8, FP1. The
    > databases have been created on an AIX server (version 4.3.3).
    > Have a look at this:
    >
    > [db2inst8@mymach ine][/db2users/db2inst8]>db2 ? list
    > DB21034E The command was processed as an SQL statement because it was not
    > a
    > valid Command Line Processor command. During SQL processing it returned:
    > SQL1024N A database connection does not exist. SQLSTATE=08003
    > [db2inst8@mymach ine][/db2users/db2inst8]>cd sqllib
    > [db2inst8@mymach ine][/db2users/db2inst8/sqllib]>db2 ? list[/color]
    [...]

    I believe you have a file with a name that consists only of a single
    character undir /db2users/db2inst8/ and that is causing your problem. You
    see, the '?' is a special character in most shells and interpreted/expanded
    before db2 is called.

    For example, you can try this:

    $ echo ?
    ?
    $ touch a
    $ echo ?
    a

    As you can see, the '?' is expanded if a matching file (here 'a') exists.

    You have most probably the same situation and you do not send "? list" to
    db2 but something like "x list". And that is something db2 tries to
    interpret as command or sql statement and, of course, fails giving you the
    error you saw.

    Either you delete the file(s), go to a directory where no single-character
    file exists, or you use quotes to prevent the shell from interpreting
    special characters.

    db2 "? list"

    I would strongly recommend the quoting because it will also avoid similar
    problems for other characters like '*' as in "SELECT * FROM table".


    --
    Knut Stolze
    Information Integration
    IBM Germany / University of Jena

    Comment

    • Pascal Deparis

      #3
      Re: Problem in V8 : db2 ? command

      Thank you very much for your help.

      In fact, I've got the x and s files under my /db2users/db2inst8 directory.
      So, when I type echo ?, I've got the result : s x

      And in my sqllib directory, there is no file name with a single character,
      so no problem!

      Pascal.

      "Knut Stolze" <stolze@de.ibm. com> a écrit dans le message news:
      br47de$9me$1@fs uj29.rz.uni-jena.de...[color=blue]
      > Pascal Deparis <pdeparis@partn er.auchan.com> wrote:
      >[color=green]
      > > Hi,
      > >
      > > I've got a problem with the DB2 Command Line Processor, in V8, FP1. The
      > > databases have been created on an AIX server (version 4.3.3).
      > > Have a look at this:
      > >
      > > [db2inst8@mymach ine][/db2users/db2inst8]>db2 ? list
      > > DB21034E The command was processed as an SQL statement because it was[/color][/color]
      not[color=blue][color=green]
      > > a
      > > valid Command Line Processor command. During SQL processing it[/color][/color]
      returned:[color=blue][color=green]
      > > SQL1024N A database connection does not exist. SQLSTATE=08003
      > > [db2inst8@mymach ine][/db2users/db2inst8]>cd sqllib
      > > [db2inst8@mymach ine][/db2users/db2inst8/sqllib]>db2 ? list[/color]
      > [...]
      >
      > I believe you have a file with a name that consists only of a single
      > character undir /db2users/db2inst8/ and that is causing your problem. You
      > see, the '?' is a special character in most shells and[/color]
      interpreted/expanded[color=blue]
      > before db2 is called.
      >
      > For example, you can try this:
      >
      > $ echo ?
      > ?
      > $ touch a
      > $ echo ?
      > a
      >
      > As you can see, the '?' is expanded if a matching file (here 'a') exists.
      >
      > You have most probably the same situation and you do not send "? list" to
      > db2 but something like "x list". And that is something db2 tries to
      > interpret as command or sql statement and, of course, fails giving you the
      > error you saw.
      >
      > Either you delete the file(s), go to a directory where no single-character
      > file exists, or you use quotes to prevent the shell from interpreting
      > special characters.
      >
      > db2 "? list"
      >
      > I would strongly recommend the quoting because it will also avoid similar
      > problems for other characters like '*' as in "SELECT * FROM table".
      >
      >
      > --
      > Knut Stolze
      > Information Integration
      > IBM Germany / University of Jena[/color]


      Comment

      Working...