473,396 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SET SESSION AUTHORIZATION

Hi,

I have a problem with a special sql.
My configuration : IBM DB2 V8.1.5 / AIX

Procedure:
CREATE PROCEDURE DB2TARAN.SetSessionAutor()
SPECIFIC x.SetSessionAutor
LANGUAGE SQL
P1: BEGIN
SET SESSION AUTHORIZATION user ;END P1

SQL0428N The SQL statement is only
allowed as the first statement in a
unit of work.

Thanks in advance

Nov 12 '05 #1
3 4749
zbychu wrote:
Hi,

I have a problem with a special sql.
My configuration : IBM DB2 V8.1.5 / AIX

Procedure:
CREATE PROCEDURE DB2TARAN.SetSessionAutor()
SPECIFIC x.SetSessionAutor
LANGUAGE SQL
P1: BEGIN
SET SESSION AUTHORIZATION user ;END P1

SQL0428N The SQL statement is only
allowed as the first statement in a
unit of work.

Thanks in advance

Interesting I never thought of this register being set in a proc, but it
does make sense...
Do you get the error message from CREATE PROCEDURE or from CALL.
The fisrt statement in your transaction would be the CALL. So the
error message is correct.
You should(!) be able to straighten things out by adding the COMMIT
before the SET inside the procedure.
If that doesn't work I would consider it a bug.
You could then try EXECUTE IMMEDIATE SET .... .
That of course would require the invoker of the procedure to be DBADM or
you will get an authorization error.

Cheers
Serge
Nov 12 '05 #2
What the problem is:
user have GRANT to tables SELECT only
and EXECUTE to procedures -> one way to INSERT and UPDATE
bat if DYNAMIC SQL in procedure included 'INSERT ...' ,
the error SQL0551N
I try by SET AUTHORIZATION set temporary "grant" on user
Is another way ?
Serge Rielau wrote:
zbychu wrote:
Hi,

I have a problem with a special sql.
My configuration : IBM DB2 V8.1.5 / AIX

Procedure:
CREATE PROCEDURE DB2TARAN.SetSessionAutor()
SPECIFIC x.SetSessionAutor
LANGUAGE SQL
P1: BEGIN
SET SESSION AUTHORIZATION user ;END P1

SQL0428N The SQL statement is only
allowed as the first statement in a
unit of work.

Thanks in advance

Interesting I never thought of this register being set in a proc, but it
does make sense...
Do you get the error message from CREATE PROCEDURE or from CALL.
The fisrt statement in your transaction would be the CALL. So the
error message is correct.
You should(!) be able to straighten things out by adding the COMMIT
before the SET inside the procedure.
If that doesn't work I would consider it a bug.
You could then try EXECUTE IMMEDIATE SET .... .
That of course would require the invoker of the procedure to be DBADM or
you will get an authorization error.

Cheers
Serge


Nov 12 '05 #3
zbychu wrote:
What the problem is:
user have GRANT to tables SELECT only
and EXECUTE to procedures -> one way to INSERT and UPDATE
bat if DYNAMIC SQL in procedure included 'INSERT ...' ,
the error SQL0551N
I try by SET AUTHORIZATION set temporary "grant" on user
Is another way ?
Serge Rielau wrote:
zbychu wrote:
Hi,

I have a problem with a special sql.
My configuration : IBM DB2 V8.1.5 / AIX

Procedure:
CREATE PROCEDURE DB2TARAN.SetSessionAutor()
SPECIFIC x.SetSessionAutor
LANGUAGE SQL
P1: BEGIN
SET SESSION AUTHORIZATION user ;END P1

SQL0428N The SQL statement is only
allowed as the first statement in a
unit of work.

Thanks in advance

Interesting I never thought of this register being set in a proc, but
it does make sense...
Do you get the error message from CREATE PROCEDURE or from CALL.
The fisrt statement in your transaction would be the CALL. So the
error message is correct.
You should(!) be able to straighten things out by adding the COMMIT
before the SET inside the procedure.
If that doesn't work I would consider it a bug.
You could then try EXECUTE IMMEDIATE SET .... .
That of course would require the invoker of the procedure to be DBADM
or you will get an authorization error.

Cheers
Serge


I see. Take a look at the BIND/PREP options for "DYNAMIC RULLES".
There is a procedure SET_ROUTINE_OPTS() which you can use to set options
for SQL Procedures. I have never tried that though.

Cheers
Serge
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: shank | last post by:
Will Session() (created in SSL) hold its value in SSL, when you go from https://abc to https://xyz and back to https://abc ? Mine does not appear to retain its value. thanks
1
by: bharath | last post by:
Hi Can anyone help me with Session Management in ASP.NET. I have a web application with a login page and i need to retain the username after he logs in. This is what I have in Config Files ...
2
by: Matt | last post by:
Hello, I'm working on a portal derived from IBuySpy, and I have changed I check username and pwd against a database, then I make a Session= UserID (the ID I get from the database, if it...
0
by: Nabani Silva | last post by:
Hi, hope someone could help I need to share session state (and contents) through differente web applications. I'm trying to get it done by using StateServer session state, below I paste code...
5
by: Chris Ochs | last post by:
It doesn't currently seem possible to switch between different users using SET SESSION AUTHORIZATION. If I log in as the superuser and switch to another user that works, but if I then switch to a...
3
by: na | last post by:
I am using form authentication and InProc cookieless session. The strange thing is that when an authenticated user try to navigate to any page that is in subfolder of the application root, the...
2
by: jack | last post by:
HI i have tried different types of form based authentications but im not able to get how to make a session level authorization. im a begginer and im not able to make that difference off like what...
2
by: Tomas Martinez | last post by:
Hi, Well, my problem is so simple as it says in the subjet but very frustrating also. I have a project and it is losing the session variables with each postback, so I downloaded from the web a...
10
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I've been on this for a while, and cannot figure it out. Can someone please help with this message? SessionState can only be used when EnableSessionState is set to true, either in a...
4
by: Bjorn Sagbakken | last post by:
In a web-application with login creds (user, pwd), these are checked against a user table on a SQL server. On a positive validation I have saved the userID, name, custno and role-settings in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.