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 why this doesn't work?