By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,851 Members | 1,729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,851 IT Pros & Developers. It's quick & easy.

db2cmd.....

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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.