467,882 Members | 1,168 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

setting user name password and user name for automating create script

hi

I am trying to create the database using a BAT file but the script is not recognizing the username and password sent as parameters and gives error.

The BAT looks like following -

and called as c:\ testit.bat db2admin S0meP@ss123
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------

@Echo Off

set dbuser = %1
set pwd = %2

db2cmd /c /w /i db2 ATTACH TO DB2 USER %dbuser% USING %pwd%
if not %errorlevel% == 0 goto error

db2cmd /c /w /i db2 CREATE DATABASE SAMPLE2
if not %errorlevel% == 0 goto error
Echo " CREATE DB IS DONE..."

:error
echo "Error" >> commands.log
exit

:end
echo "OK" >> commands.log
exit

----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Aug 17 '07 #1
  • viewed: 1317
Share:

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.