I would like to get an Oracle session ID in my Java app.
When I say Oracle session ID, I mean the users session ID on the Oracle DB, not the DB SID. For example, I know I can get the users ID by executing "SELECT sys_context('USERENV','SID') from dual;" but rather than executing this query I was wondering if there is an API operation where I can get this info? I've tried all the DatabaseMetaData methods and properties, but it doesn't look like there is a specific API call for this.
The reason for doing this is for tracking users sessions between the app and db layer. It will help identify long running queries and what the user was doing to get long running queries in that specific state.