db2cmd.....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Postlbauer

    db2cmd.....

    hi newsgroup,
    is there a way to pass a parameter (e.g. password) to a db2script?
    Example:
    db2cmd /c db2 -t -fscript.clp

    script.clp:
    ----------
    connect to mydatabase user myself using password;
    export to mytable.ixf of ixf messages mytable.msg select * from mytable;
    connect reset;
    -----------

    thanx for any hint, peter


  • Gert van der Kooij

    #2
    Re: db2cmd.....

    In article <e0vqeu$q78$1@n ewsreader1.utan et.at>, peter.postlbaue r@apk.at
    says...[color=blue]
    > hi newsgroup,
    > is there a way to pass a parameter (e.g. password) to a db2script?
    > Example:
    > db2cmd /c db2 -t -fscript.clp
    >
    > script.clp:
    > ----------
    > connect to mydatabase user myself using password;
    > export to mytable.ixf of ixf messages mytable.msg select * from mytable;
    > connect reset;
    > -----------
    >[/color]

    No, unfortunately it isn't.
    I always use rexx scripts to run the DB2 commmands. If you want/need to
    get used to rexx and DB2 you can find two articles at developersworld at
    the following (wrapped) links:

    Script for DB2 Universal Database using REXX: Learn REXX fast
    at

    0508fosdick/index.html?ca=d rs-

    and

    Script for DB2 Universal Database using REXX: Quick DB2 UDB scripting
    at

    0508fosdick1/index.html?ca=d rs-

    Offcourse other scripting languages can do (almost) the same or more
    then rexx.

    Comment

    • Peter Postlbauer

      #3
      Re: db2cmd.....

      "Gert van der Kooij" <nomail@nl.inva lid> schrieb im Newsbeitrag
      news:MPG.1e9d8d 61f3d047fd9896f 6@news.xs4all.n l...[color=blue]
      > In article <e0vqeu$q78$1@n ewsreader1.utan et.at>, peter.postlbaue r@apk.at
      > says...[color=green]
      > > hi newsgroup,
      > > is there a way to pass a parameter (e.g. password) to a db2script?
      > > Example:
      > > db2cmd /c db2 -t -fscript.clp[/color]
      >
      > No, unfortunately it isn't.
      > I always use rexx scripts to run the DB2 commmands. If you want/need to[/color]

      many thanx for your hint (and help), so I'll use rexx
      regards, peter


      Comment

      • ivb

        #4
        Re: db2cmd.....

        If you concrete task is secure password: (for Windows):

        file starter.bat:
        db2cmd -c script.bat %1

        file script.bat:
        db2 connect to MYDB user db2admin using %1
        db2 -td@ -f script1.sql -z log.out
        db2 -td@ -f script2.sql -z log.out
        db2 QUIT

        Comment

        • situ

          #5
          Re: db2cmd.....

          check it out

          SET DB_NAME=%1
          SET USER_NAME=%2
          SET PASSWORD=%3

          db2 CONNECT TO %DB_NAME% user %USER_NAME% USING %PASSWORD%
          db2 -vf cr_loy_ddl.sql -t +o -l cr_loy_ddl.log

          this one i ran it through batch file

          Comment

          Working...