plq
asked on
How to tell what application role your connection is currently using
Is there some way to select (e.g. from the sys tables) the current application role ?
I have the classic "General Network Error" caused by calling sp_setapprole when the oledb connection.open method returns a pooled connection. (see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q229564)
If I can detect the application role I can stop this error from happening and still get the performance gains of connection pooling which I think we need.
thanks
I have the classic "General Network Error" caused by calling sp_setapprole when the oledb connection.open method returns a pooled connection. (see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q229564)
If I can detect the application role I can stop this error from happening and still get the performance gains of connection pooling which I think we need.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Actually my above post didn't work outside of query analyser.
ASKER
This will return no rows if you're out of an app role, and a uid if you're in an app role
select a.uid
from master..sysprocesses as a
inner join sysusers as b on a.uid = b.uid
where a.spid = @@spid
and b.isapprole = 1
I think running that select on login before calling sp_setapprole is a better workaround than Microsoft's
Thanks for the answer though - that is a viable alternative.