467,088 Members | 1,322 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

GRANT statement gives authorization id not valid error

Hi,

I am trying to grant connect privilege to a user present on my O.S.
(Windows) using following statement.

GRANT CONNECT ON DATABASE TO user "user1"

now when I execute this statemnt from db2 clp(ofcourse prefixing db2)
it works fine, but when I put it inside an sql file and then when I try
to run the file using db2 -tvf, it gives me following error msg
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0567N "user1" is not a valid authorization ID. SQLSTATE=42602

I also tried running the above statemnt from db2 command line
interactive mode, it also results in above error.
I intend to execute above statement programmatically, hence I need to
use sql file.

Any solutions?

Sep 11 '06 #1
  • viewed: 5285
Share:
4 Replies
Jatinder wrote:
Hi,

I am trying to grant connect privilege to a user present on my O.S.
(Windows) using following statement.

GRANT CONNECT ON DATABASE TO user "user1"

now when I execute this statemnt from db2 clp(ofcourse prefixing db2)
it works fine, but when I put it inside an sql file and then when I try
to run the file using db2 -tvf, it gives me following error msg
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0567N "user1" is not a valid authorization ID. SQLSTATE=42602

I also tried running the above statemnt from db2 command line
interactive mode, it also results in above error.
Remove the double quotes. Those quotes cause DB2 to take the user name as
case-sensitive string. If you execute it on the db2 clp (i.e. an operating
system shell), the shell interprets the double quotes and DB2 never sees
them.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 11 '06 #2
Without quotes works, however the user name has a space in the name,
now how do I handle this if I am not to use double quotes? I tried
single quote, but it gives
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "'user1'" was found following "on
database to
user". Expected tokens may include: "END-OF-STATEMENT".
SQLSTATE=42601

Knut Stolze wrote:
Jatinder wrote:
Hi,

I am trying to grant connect privilege to a user present on my O.S.
(Windows) using following statement.

GRANT CONNECT ON DATABASE TO user "user1"

now when I execute this statemnt from db2 clp(ofcourse prefixing db2)
it works fine, but when I put it inside an sql file and then when I try
to run the file using db2 -tvf, it gives me following error msg
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0567N "user1" is not a valid authorization ID. SQLSTATE=42602

I also tried running the above statemnt from db2 command line
interactive mode, it also results in above error.

Remove the double quotes. Those quotes cause DB2 to take the user name as
case-sensitive string. If you execute it on the db2 clp (i.e. an operating
system shell), the shell interprets the double quotes and DB2 never sees
them.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 11 '06 #3
Jatinder wrote:
Without quotes works, however the user name has a space in the name,
Fold the name to all upper case, then. This is what's happening w/o quotes.
Since you need those quotes because of the special characters, you have to
perform that step yourself.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 11 '06 #4
It works after I have all the characters in double quotes as uppercase.
Thanks!

Jatinder
Knut Stolze wrote:
Jatinder wrote:
Without quotes works, however the user name has a space in the name,

Fold the name to all upper case, then. This is what's happening w/o quotes.
Since you need those quotes because of the special characters, you have to
perform that step yourself.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Sep 11 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by richard | last post: by
6 posts views Thread by tshad | last post: by
2 posts views Thread by craigkenisston@hotmail.com | last post: by
6 posts views Thread by john_woo@canada.com | last post: by
1 post views Thread by shsandeep | last post: by
2 posts views Thread by Amber | last post: by
23 posts views Thread by florian.loitsch@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.