467,198 Members | 1,210 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,198 developers. It's quick & easy.

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
Apr 5 '06 #1
  • viewed: 9537
Share:
4 Replies
In article <e0**********@newsreader1.utanet.at>, pe**************@apk.at
says...
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;
-----------


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
http://www-128.ibm.com/developerwork...echarticle/dm-
0508fosdick/index.html?ca=drs-

and

Script for DB2 Universal Database using REXX: Quick DB2 UDB scripting
at
http://www-128.ibm.com/developerwork...echarticle/dm-
0508fosdick1/index.html?ca=drs-

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

Apr 5 '06 #2
"Gert van der Kooij" <no****@nl.invalid> schrieb im Newsbeitrag
news:MP************************@news.xs4all.nl...
In article <e0**********@newsreader1.utanet.at>, pe**************@apk.at
says...
hi newsgroup,
is there a way to pass a parameter (e.g. password) to a db2script?
Example:
db2cmd /c db2 -t -fscript.clp


No, unfortunately it isn't.
I always use rexx scripts to run the DB2 commmands. If you want/need to


many thanx for your hint (and help), so I'll use rexx
regards, peter
Apr 5 '06 #3
ivb
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

Apr 5 '06 #4
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

Apr 5 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by rhjaisingh@gmail.com | last post: by
4 posts views Thread by reachsamdurai@gmail.com | last post: by
reply views Thread by wb5plj@gmail.com | last post: by
6 posts views Thread by Mesan | last post: by
2 posts views Thread by Azahary | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.