Whahoo!

Following its_toasted's recipes I have successfully implemented, successively, 
both Tomcat managed Database pooling and Hibernate Managed Database pooling.

I did have a couple of issues to fix when implementing Hibernate managed 
pooling:
1) Order of entries into the xml.  I first simply appended the database connection and 
pooling properties to my existing hibernate,cfg.xml.  Wrong!  The "mapping" 
element must come AFTER the property elements to conform to the dtd.
2) I had to comment out the datasource property for the configuration to work.  
Its-toated referred to this porblem in the context of Tomcat managed pooling, 
but I had no problem with it there.  I did have problems with that issue when 
configuring the Hibernate managed pooling.  I have included here the 
hibernate.cfg.xml that works for me.  Note the datasource property commented 
out.

<hibernate-configuration>

 <session-factory>

<!--
   <property name="connection.datasource">java:comp/env/jdbc/CSRapp</property>
-->
   <property name="show.sql">false</property>
   <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

   <!-- Database connection information -->
   <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
   <property name="connection.url">jdbc:mysql://localhost:3306/CSRapp</property>
   <property name="connection.username">CSRapp</property>
   <property name="connection.password">CSRapp</property>

   <!-- Connection pool parameters -->
   <property 
name="connection_provider_class">org.hibernate.connection.CP30ConnectionProvider</property>
   <property name="c3p0.minPoolSize">4</property>
   <property name="c3p0.timeout">5000</property>

   <!-- Mapping files -->
   <mapping resource="org/bcs/server/utils/ServiceProvider.hbm.xml"/>

 </session-factory>

</hibernate-configuration>

Wanting my database configuration tightly coupled to my application, the 
Hibernate managed approach works best for me.

Thank you all for a great job and great help.

Caldarale, Charles R wrote:
From: its_toas...@yahoo.com [mailto:its_toas...@yahoo.com]
Subject: Re: Seeking the right solution to
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

PS - I just hacked together the Hibernate-controlled database
connection / pooling on a freshly installed Tomcat 6.0.20.
It works as advertised.


A very comprehensive and useful writeup; thanks.  Please consider adding the 
Hibernate-controlled pooling description to the Tomcat FAQ/Wiki Database 
section - or at least a pointer to the relevant Hibernate doc.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to