By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,541 Members | 1,106 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,541 IT Pros & Developers. It's quick & easy.

get a session id of database in java

dmjpro
100+
P: 2,476
I made a connection in oracle through JDBC.
I want the session id for that connection through java..............
Plz help me out .........................
Jan 31 '07 #1
Share this Question
Share on Google+
2 Replies


100+
P: 168
You can get the session ID from the Oracle v$ tables using the following queries. SYS_CONTEXT is the preferred method from 8.x on.


//For Oracle 7.x on up to 10g
SELECT SID FROM V$SESSION
WHERE AUDSID = USERENV('SESSIONID');

//For Oracle 8.x on up to 10g
SELECT SID FROM V$SESSION
WHERE AUDSID = SYS_CONTEXT('USERENV','SESSIONID');
Feb 18 '07 #2

dmjpro
100+
P: 2,476
can't i get the connection back after i write


l_con.close() method
Feb 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.