application-role

Detecting unusable pooled SqlConnections

随声附和 提交于 2020-01-13 06:57:49
问题 When I attempt to set an application role on a SqlConnection with sp_setapprole I sometimes get the following error in the Windows event log... The connection has been dropped because the principal that opened it subsequently assumed a new security context, and then tried to reset the connection under its impersonated security context. This scenario is not supported. See "Impersonation Overview" in Books Online.) ... and a matching exception is thrown in my application. These are pooled

JDBC set_approle

天涯浪子 提交于 2019-12-11 03:37:29
问题 I am trying to set an application role through a JDBC connection using a prepareCall. It seems to work ok (i.e. syntax wise) but SQL server 2008 returns this error: Application roles can only be activated at the ad hoc level I am not firing this from within a stored procedure or anything, just directly from my JDBC connection, as such: CallableStatement cstmt = con.prepareCall("{call sys.sp_setapprole(?, ?, ?, ?)}"); //setup all the IN and OUT parameters here cstmt.execute(); Any ideas for

How can I detect condition that causes exception before it happens?

蹲街弑〆低调 提交于 2019-12-06 05:41:20
问题 I had no luck with this question so I've produced this simple-as-possible-test-case to demonstrate the problem. In the code below, is it possible to detect that the connection is unusable before trying to use it? SqlConnection c = new SqlConnection(myConnString); c.Open(); // creates pool setAppRole(c); // OK c.Close(); // returns connection to pool c = new SqlConnection(myConnString); // gets connection from pool c.Open(); // ok... but wait for it... // ??? How to detect KABOOM before it

Detecting unusable pooled SqlConnections

无人久伴 提交于 2019-12-04 18:38:33
When I attempt to set an application role on a SqlConnection with sp_setapprole I sometimes get the following error in the Windows event log... The connection has been dropped because the principal that opened it subsequently assumed a new security context, and then tried to reset the connection under its impersonated security context. This scenario is not supported. See "Impersonation Overview" in Books Online.) ... and a matching exception is thrown in my application. These are pooled connections, and there was a time when connection pooling was incompatible with app roles - in fact the old

How can I detect condition that causes exception before it happens?

梦想与她 提交于 2019-12-04 10:54:05
I had no luck with this question so I've produced this simple-as-possible-test-case to demonstrate the problem. In the code below, is it possible to detect that the connection is unusable before trying to use it? SqlConnection c = new SqlConnection(myConnString); c.Open(); // creates pool setAppRole(c); // OK c.Close(); // returns connection to pool c = new SqlConnection(myConnString); // gets connection from pool c.Open(); // ok... but wait for it... // ??? How to detect KABOOM before it happens? setAppRole(c); // KABOOM The KABOOM manifests as a error in the Windows event log; The connection