Newbie warning ...
I'm trying to figure out how I could determine the current username when in
a table function (in fact I'm writing some java code that plugs into
someone else's table function ...)
I was originally thinking of something like the snippet below. However this
doesn't work (I get an SQL Transient Exception).
I don't know derby well but saw some discussion around not exposing the
language context in any case (due to security concerns)
Given this can anyone suggest the simplest way to retrieve the authorised
user?
ContextManager contextMgr = ((EmbedConnection)
DriverManager.getConnection("jdbc:default:connection")).getContextManager();
LanguageConnectionContext languageContext =
(LanguageConnectionContext)contextMgr.getContext("LanguageConnectionContext");
StatementContext derbyStatementContext = languageContext.getStatementContext();
String localDerbyContextCurrentUser =
derbyStatementContext.getSQLSessionContext().getCurrentUser();
Many thanks
Nigel.