Hello!

I am wondering what the proper way of handling a database connection  
pool when it looses connection to the database.  My application will  
run fine for 2 weeks then it will start throwing broken pipe errors.   
I don't have the exact error but that is what the error says.  I use a  
postgres database and the c3po hibernate connection pool.  How do I  
ensure connectivity is maintained?

Maybe a database connection interceptor?  Just an idea.....

Here is my persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/ 
persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";  
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd 
">
     <persistence-unit name="loginPU" transaction-type="RESOURCE_LOCAL">
         <provider>org.hibernate.ejb.HibernatePersistence</provider>
         <exclude-unlisted-classes>false</exclude-unlisted-classes>
         <properties>
             <property name="hibernate.cache.provider_class"  
value="org.hibernate.cache.NoCacheProvider"/>
             <property name="hibernate.archive.autodetection"  
value="class"/>
             <property name="hibernate.dialect"  
value="org.hibernate.dialect.PostgreSQLDialect"/>
             <property name="jdbc.batch_size" value="0"/>
       <!-- Testing DB -->
       <!-- Fiveish DB -->
       <!-- <property name="hibernate.connection.username"  
value="xxxxxxxx"/>
       <property name="hibernate.connection.password"  
value="xxxxxxxxx"/>
       <property name="hibernate.connection.url"  
value="jdbc:postgresql://localhost/cheapdb"/> -->
       <!-- configuration connection pool via c3p0-->
             <property name="c3p0.acquire_increment" value="1"/>
             <property name="c3p0.idle_test_period" value="3000"/>
       <!-- seconds -->
             <property name="c3p0.max_size" value="20"/>
             <property name="c3p0.max_statements" value="50"/>
             <property name="c3p0.min_size" value="5"/>
             <property name="c3p0.timeout" value="100"/>
             <property name="hibernate.show_sql" value="true"/>
             <property name="hibernate.connection.driver_class"  
value="org.postgresql.Driver"/>

       <!-- Dev -->

             <property name="hibernate.connection.username"  
value="xxxxxxxx"/>
             <property name="hibernate.connection.password"  
value="xxxxxxxx"/>
             <property name="hibernate.connection.url"  
value="jdbc:postgresql://localhost/postgres"/>


       <!-- Production -->


             <!-- <property name="hibernate.connection.username"  
value="xxxxxxxx"/>
             <property name="hibernate.connection.password"  
value="xxxxxxxxxx"/>
             <property name="hibernate.connection.url"  
value="jdbc:postgresql://localhost/joaquinv_cheap"/> -->




             <property name="hibernate.hbm2ddl.auto" value="update"/>
         </properties>
     </persistence-unit>
</persistence>



Thanks!
Joaquin



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to