Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / April 2006

Tip: Looking for answers? Try searching our database.

db2cmd.....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Postlbauer - 05 Apr 2006 08:09 GMT
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 - 05 Apr 2006 08:17 GMT
> hi newsgroup,
> is there a way to pass a parameter (e.g. password) to a db2script?
[quoted text clipped - 7 lines]
> 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/developerworks/db2/library/techarticle/dm-
0508fosdick/index.html?ca=drs-

and

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

Offcourse other scripting languages can do (almost) the same or more
then rexx.
Peter Postlbauer - 05 Apr 2006 08:27 GMT
> > hi newsgroup,
> > is there a way to pass a parameter (e.g. password) to a db2script?
[quoted text clipped - 3 lines]
> 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
ivb - 05 Apr 2006 16:13 GMT
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
situ - 05 Apr 2006 16:39 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.