This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes JDBC connection state after ending session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC connection state after ending session" Watch "JDBC connection state after ending session" New topic
Author

JDBC connection state after ending session

lily ling
Greenhorn

Joined: Dec 03, 2001
Posts: 25
I am using XML/XSL/XSP to build website. I have a xsp page which contains database accessing coding and I have "finally" block to close connections, of course. My question is : if a user end the session by any means ( either logout or close the browser ) during the database transaction, will the finally block executed or not ?
Any advice is appreciated.
Lily
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
Since the finally block is supposed to execute if there was an excepton or not, I believe it should execute, because the browser will terminate the session.
------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
lily ling
Greenhorn

Joined: Dec 03, 2001
Posts: 25
Thank you ,Bosun.
By the way, may I ask if the user terminate the session, what kind of exception the JVM will get ?
Lily
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC connection state after ending session
 
Similar Threads
frnds come up with solution
JSP vs XSP
what is correct way to close statement , connection , resultset...
XSP
i lost the database connection after 10 hours .. hibernate do cry myself ;..(