These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: WebSphere-Hibernate-MySql connection issue(can not reconnect
PostPosted: Fri Nov 20, 2009 11:47 am 
Newbie

Joined: Wed Aug 12, 2009 11:49 am
Posts: 6
Now I'm using Hibernate, MySql and Websphere, MySql has 8 hours timeout, after timeout, my application can't connect to MySql first, but second time it is ok.

I tried to use C3P0 connection pool in hibernate configure file, but it is still unsucessful.

the following is my cfg file.

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.datasource">java:comp/env/jdbc/loyaltycentral</property>
<!--
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
-->

<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">80</property>
<property name="hibernate.c3p0.timeout">8</property>
<property name="hibernate.c3p0.max_statements">500</property>
<property name="hibernate.c3p0.idle_test_period">10</property>
<property name="hibernate.c3p0.acquire_increment">2</property>

<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- <property name="hibernate.jdbc.use_get_generated_keys">true</property> -->
<mapping resource="hbmappings/OrganisationHierarchy.hbm.xml"/>

Anybody knows the reason? thanks


Top
 Profile  
 
 Post subject: Re: WebSphere-Hibernate-MySql connection issue(can not reconnect
PostPosted: Fri Feb 12, 2010 10:18 am 
Regular
Regular

Joined: Thu May 07, 2009 5:56 am
Posts: 94
Location: Toulouse, France
when you configure Hibernate to use a DataSource that's useless to configure a C3P0 provider because Hibernate doesn't use it. in fact, you must set pooling properties (and all other) directly in your DataSource definition.

_________________
everything should be made as simple as possible, but not simpler (AE)


Top
 Profile  
 
 Post subject: Re: WebSphere-Hibernate-MySql connection issue(can not reconnect
PostPosted: Sat Feb 13, 2010 10:45 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
What about leveraging WebSphere's connection pooling?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.