I am running this command.
db2 "CREATE SERVER <servername> TYPE DB2/UDB VERSION 8.2 WRAPPER DRDA
AUTHORIZATION "authid" PASSWORD "pwd" OPTIONS( DBNAME 'dbname',
PASSWORD 'Y')"
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL1822N Unexpected error code "-30082" received from data source
"DBNAME".
Associated text and tokens are " SQL30082N Attempt to establish
connection
I go into db2 prompt and I do this
db2 => CREATE SERVER <servername> TYPE DB2/UDB VERSION 8.2 WRAPPER DRDA
AUTHORIZATION "authid" PASSWORD "pwd" OPTIONS( DBNAME 'dbname',
PASSWORD 'Y')
This works. Can anybody tell me why the former fails while the one
latter works? Is it the problem with quotes around the auth id and
pwd????
Any help appreciated.
Put the first statement in a file and run like this
db2 -tvf <file>
CREATE SERVER <servername> TYPE DB2/UDB VERSION 8.2 WRAPPER DRDA
> AUTHORIZATION "authid" PASSWORD "pwd" OPTIONS( DBNAME 'dbname',
> PASSWORD 'Y'
cheers..
Shashi Mannepalli
> I am running this command.
>
[quoted text clipped - 21 lines]
>
> Any help appreciated.
amalnair@gmail.com - 13 Dec 2006 21:09 GMT
This essentially means I will have to hardcode the password in the sql
file right? I would not want to do that.
> Put the first statement in a file and run like this
>
[quoted text clipped - 32 lines]
> >
> > Any help appreciated.
> I am running this command.
>
> db2 "CREATE SERVER <servername> TYPE DB2/UDB VERSION 8.2 WRAPPER DRDA
> AUTHORIZATION "authid" PASSWORD "pwd" OPTIONS( DBNAME 'dbname',
> PASSWORD 'Y')"
Have a look at this from a shell perspective. You have:
db2 "..."authid"..."pwd"..."
Note that double-quotes begin/end strings. Now notice what the nested
double-quotes are doing. They terminate a string and are not passed to
DB2. Therefore, DB2 will get the following SQL statement:
CREATE SERVER <servername> TYPE DB2/UDB VERSION 8.2 WRAPPER DRDA
AUTHORIZATION authid PASSWORD pwd
OPTIONS( DBNAME 'dbname', PASSWORD 'Y')
authid and pwd are unquoted, which means they will be upper-cased. (Things
are even worse if your pwd contains special characters.) To remedy the
situation, you have to make sure that your double-quote characters are not
handled by your shell and passed to DB2 instead by escaping them:
db2 "CREATE SERVER <servername> TYPE DB2/UDB VERSION 8.2 WRAPPER DRDA
AUTHORIZATION \"authid\" PASSWORD \"pwd\"
OPTIONS( DBNAME 'dbname', PASSWORD 'Y')"

Signature
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Asphalt Blazer - 14 Dec 2006 14:46 GMT
Thanks, I understood what was happening. What I was looking for was the
remedy. Thanks a lot. I appreciate it.
> > I am running this command.
> >
[quoted text clipped - 22 lines]
> AUTHORIZATION \"authid\" PASSWORD \"pwd\"
> OPTIONS( DBNAME 'dbname', PASSWORD 'Y')"