<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: java.sql.SQLException: Closed Connection</title>
	<atom:link href="http://www.techpitcher.com/javasqlsqlexception-closed-connection.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.techpitcher.com/javasqlsqlexception-closed-connection.html</link>
	<description></description>
	<lastBuildDate>Tue, 22 Jun 2010 14:46:24 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: TechPitcher</title>
		<link>http://www.techpitcher.com/javasqlsqlexception-closed-connection.html/comment-page-1#comment-166</link>
		<dc:creator>TechPitcher</dc:creator>
		<pubDate>Tue, 17 Mar 2009 05:23:39 +0000</pubDate>
		<guid isPermaLink="false">http://techpitcher.com/?p=155#comment-166</guid>
		<description>The operation seems to pick a stale connection from the pool which is expired.
It so happens that the connection has become inactive in the pool or it’s closed by some other operation, and is picked by this operation to run query on. This doesn’t seem to do anything with IBatis as such, because the problem is at connection end. While doing next on the resultset or getting the resultset it realizes that the connection has already been closed. So running query on a closed exception throws this error.

The focus of the problem shifts to know why we are getting a connection which is closed. If we are sure that we are not doing this by ourselves explicitly at some other place then there could be other reason that sometimes in the connection pool there are connections which has become inactive or timed-out. When such connections are picked up for running queries, this exception is thrown. In most of other connection pool configuration, every connection in the pool is validated before it’s given to any application. Remember we use “SELECT 1 “kind of queries to test the connection in a lot of general applications. If the query fails, the connection is removed from the pool and another one is tried.

This is what appears from the given stack trace. If you have additional information, please provide it to me so that I can see it in a better way.</description>
		<content:encoded><![CDATA[<p>The operation seems to pick a stale connection from the pool which is expired.<br />
It so happens that the connection has become inactive in the pool or it’s closed by some other operation, and is picked by this operation to run query on. This doesn’t seem to do anything with IBatis as such, because the problem is at connection end. While doing next on the resultset or getting the resultset it realizes that the connection has already been closed. So running query on a closed exception throws this error.</p>
<p>The focus of the problem shifts to know why we are getting a connection which is closed. If we are sure that we are not doing this by ourselves explicitly at some other place then there could be other reason that sometimes in the connection pool there are connections which has become inactive or timed-out. When such connections are picked up for running queries, this exception is thrown. In most of other connection pool configuration, every connection in the pool is validated before it’s given to any application. Remember we use “SELECT 1 “kind of queries to test the connection in a lot of general applications. If the query fails, the connection is removed from the pool and another one is tried.</p>
<p>This is what appears from the given stack trace. If you have additional information, please provide it to me so that I can see it in a better way.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
