aspose file tools*
The moose likes JDBC and the fly likes JDBC Closing a Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Closing a Connection" Watch "JDBC Closing a Connection" New topic
Author

JDBC Closing a Connection

Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi All,
In our application we are using JDBC to connect to DB2 running in Mainframe. The application is used to create very large reports. Sometime the users may run a report which may run for more than an hour so the user may close the application screen abruptly by clicking the browser top right X button.

Here in my application we are maintaining only one connection through out the users session. We will create the connection keep it in the session and will reuse the same whenever database operation is needed.

Now the problem is when the user closes the application in the middle of Report process, the Frontend application is closed but the database thread runs in the Mainframe which does not know that the Front end is closed. So the Connection we maintain is still alive even if we close the application. When the user returns back to the application (actually these applications are child windows opened from a common portal screen) from the main portal screen, since we are maintaing a single connection the user is not allowed in to the application as it hangs since the backend thread is still running.

I tried closing the connection object by issuing con.close(), con = null etc but no use. The connection object is not at all closed. Can anyone help me in killing this connection object forcefully from the Frontend. I can kill the thread from the backend but I want to close the connection from frontend only.

Any help on this is very much appreciated.


Regards,
Sivaraman.L
sathish kumar
Ranch Hand

Joined: Feb 14, 2007
Posts: 47
Where is the JDBC connection being set, in the JAVA world or in the Mainframe world. If it is in the JAVA world can you copy your code in here?

As well see if Hibernate can help you. Hibernate ORM helps you with caching connections.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC Closing a Connection