• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle User Session ID through JDBC API?

 
Joe Millers
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Please advise.
 
Joe Millers
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,
Not in JDBC because this is a database specific concept. It's possible there is a method in the Oracle driver that does it. I think your query route is best.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic