<?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: Automatic reconnect from Hibernate to MySQL</title>
	<atom:link href="http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/</link>
	<description>Adrian Smith's blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 05:20:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: AlberTaker</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-70976</link>
		<dc:creator>AlberTaker</dc:creator>
		<pubDate>Thu, 15 Sep 2011 22:02:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-70976</guid>
		<description>Hi.

I was looking for a solution to this problem. I tried all the things you say with no lucky. But I found the fix I need.

I have to configure and specified this property in my hibernate.cfg.xml (up to date version of Hibernate 3.x):
&lt;code&gt;&lt;property name=&quot;hibernate.connection.release_mode&quot;&gt;after_transaction&lt;/property&gt;&lt;/code&gt;

With this property set up several solutions works for me (the &quot;testConnectionsOnCheckout&quot; for example). I use the &quot;idle_test_period&quot; with 180 seconds and the problem is solved ;)

Thanks a lot! :)</description>
		<content:encoded><![CDATA[<p>Hi.</p>
<p>I was looking for a solution to this problem. I tried all the things you say with no lucky. But I found the fix I need.</p>
<p>I have to configure and specified this property in my hibernate.cfg.xml (up to date version of Hibernate 3.x):<br />
<code>&lt;property name="hibernate.connection.release_mode"&gt;after_transaction&lt;/property&gt;</code></p>
<p>With this property set up several solutions works for me (the &#8220;testConnectionsOnCheckout&#8221; for example). I use the &#8220;idle_test_period&#8221; with 180 seconds and the problem is solved ;)</p>
<p>Thanks a lot! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Chen</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-68967</link>
		<dc:creator>Roger Chen</dc:creator>
		<pubDate>Fri, 02 Sep 2011 01:28:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-68967</guid>
		<description>Thanks! it works!</description>
		<content:encoded><![CDATA[<p>Thanks! it works!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodrigo</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-68765</link>
		<dc:creator>Rodrigo</dc:creator>
		<pubDate>Wed, 31 Aug 2011 12:34:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-68765</guid>
		<description>I was looking for the solution to this problem, but never finding the correct reference to fix it. Your explanation points directly to solve it! And here it works fine!!!! Thanks a lot!!!</description>
		<content:encoded><![CDATA[<p>I was looking for the solution to this problem, but never finding the correct reference to fix it. Your explanation points directly to solve it! And here it works fine!!!! Thanks a lot!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dejan Vukmirović</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-52353</link>
		<dc:creator>Dejan Vukmirović</dc:creator>
		<pubDate>Fri, 27 May 2011 08:26:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-52353</guid>
		<description>Thanks!! You just saved me :)</description>
		<content:encoded><![CDATA[<p>Thanks!! You just saved me :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacomo</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-50607</link>
		<dc:creator>Jacomo</dc:creator>
		<pubDate>Mon, 16 May 2011 22:57:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-50607</guid>
		<description>Great post, love the humor as well.  Definitely pointed me in the right direction.

BTW, for those of you who&#039;ve set hibernate.c3p0.validate=true, be aware that this is a Hibernate 2.x setting only.  It does not work in Hibernate 3.x.

In 3.x you have to create the separate c3p0.properties and set c3p0.testConnectionsOnCheckout=true in there.

See this page for Hibernate-specific settings in c3p0: &lt;http://www.mchange.com/projects/c3p0/index.html#hibernate-specific&lt;</description>
		<content:encoded><![CDATA[<p>Great post, love the humor as well.  Definitely pointed me in the right direction.</p>
<p>BTW, for those of you who&#8217;ve set hibernate.c3p0.validate=true, be aware that this is a Hibernate 2.x setting only.  It does not work in Hibernate 3.x.</p>
<p>In 3.x you have to create the separate c3p0.properties and set c3p0.testConnectionsOnCheckout=true in there.</p>
<p>See this page for Hibernate-specific settings in c3p0: &lt;<a href="http://www.mchange.com/projects/c3p0/index.html#hibernate-specific&#038;lt" rel="nofollow">http://www.mchange.com/projects/c3p0/index.html#hibernate-specific&#038;lt</a>;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rao</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-46725</link>
		<dc:creator>Rao</dc:creator>
		<pubDate>Mon, 25 Apr 2011 03:36:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-46725</guid>
		<description>Hi,

I am getting following error in the JBOSS log.

[com.mchange.v2.resourcepool.BasicResourcePool] (C3P0PooledConnectionPoolManager-Helper Thread-#1) com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@15b2f35 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.lang.NullPointerException.

Thye persistence.xml is as follows



   
      org.hibernate.ejb.HibernatePersistence
      java:/testDS
      
         
         
         

         

         &lt;!-- use a file system based index --&gt;
         
         &lt;!-- directory where the indexes will be stored --&gt;
           
         &lt;!-- Not needed with HA 3.3 --&gt;
         
         
                  
         
         
         
        &lt;!-- C3P0 connection pooling to prevent connection drop outs --&gt;    
        
				
		&lt;!-- this property forces the revalidation of a connection after the given amount of time (in secs) --&gt;
		&lt;!-- it must be set to LESS than the wait_timout setting for the mysql server (this setting defaults to 28800 secs (8 hours)) --&gt;
		
		
                   
      
   



Please let me know what am I doing wrong.

I am using hibernate-c3p0-3.3.2.GA for C3P0ConnectionProvider.class and c3p0-0.9.2.jar with JBOSS,Hibernate</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am getting following error in the JBOSS log.</p>
<p>[com.mchange.v2.resourcepool.BasicResourcePool] (C3P0PooledConnectionPoolManager-Helper Thread-#1) com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@15b2f35 &#8212; Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:<br />
java.lang.NullPointerException.</p>
<p>Thye persistence.xml is as follows</p>
<p>      org.hibernate.ejb.HibernatePersistence<br />
      java:/testDS</p>
<p>         <!-- use a file system based index --></p>
<p>         <!-- directory where the indexes will be stored --></p>
<p>         <!-- Not needed with HA 3.3 --></p>
<p>        <!-- C3P0 connection pooling to prevent connection drop outs -->    </p>
<p>		<!-- this property forces the revalidation of a connection after the given amount of time (in secs) --><br />
		<!-- it must be set to LESS than the wait_timout setting for the mysql server (this setting defaults to 28800 secs (8 hours)) --></p>
<p>Please let me know what am I doing wrong.</p>
<p>I am using hibernate-c3p0-3.3.2.GA for C3P0ConnectionProvider.class and c3p0-0.9.2.jar with JBOSS,Hibernate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hibernate mySQL connection lost overnight &#171; Stumbling into Java</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-46353</link>
		<dc:creator>Hibernate mySQL connection lost overnight &#171; Stumbling into Java</dc:creator>
		<pubDate>Sat, 23 Apr 2011 05:02:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-46353</guid>
		<description>[...] Automatic reconnect from Hibernate to MySQL [...]</description>
		<content:encoded><![CDATA[<p>[...] Automatic reconnect from Hibernate to MySQL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mozcelik</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-46034</link>
		<dc:creator>mozcelik</dc:creator>
		<pubDate>Thu, 21 Apr 2011 11:31:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-46034</guid>
		<description>Thanks for the past, it solved my problem too. For the configurations I used only persistence.xml to configure c3p0. (no need to c3p0.properties file)

in persistence.xml I added properties

hibernate.connection.provider_class = org.hibernate.connection.C3P0ConnectionProvider
hibernate.c3p0.idle_test_period = 5000
hibernate.c3p0.preferredTestQuery = SELECT 1;

That&#039;s it.</description>
		<content:encoded><![CDATA[<p>Thanks for the past, it solved my problem too. For the configurations I used only persistence.xml to configure c3p0. (no need to c3p0.properties file)</p>
<p>in persistence.xml I added properties</p>
<p>hibernate.connection.provider_class = org.hibernate.connection.C3P0ConnectionProvider<br />
hibernate.c3p0.idle_test_period = 5000<br />
hibernate.c3p0.preferredTestQuery = SELECT 1;</p>
<p>That&#8217;s it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge Cordero</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-37729</link>
		<dc:creator>Jorge Cordero</dc:creator>
		<pubDate>Tue, 01 Mar 2011 21:52:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-37729</guid>
		<description>Awesome post, helped me a lot! Cheers!</description>
		<content:encoded><![CDATA[<p>Awesome post, helped me a lot! Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Silveirinha</title>
		<link>http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/comment-page-1/#comment-28340</link>
		<dc:creator>Silveirinha</dc:creator>
		<pubDate>Tue, 28 Dec 2010 15:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=315#comment-28340</guid>
		<description>you save my life!!!</description>
		<content:encoded><![CDATA[<p>you save my life!!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

