Rick,

One thing I haven't tested much is the re-connect behaviour of 
connection pooling in App Servers... we are using GlassFish v3 for our 
next App and I am curious if you have seen anything *real world* in this 
area... i.e. its great to hear what products are supposed to do but to 
hear first hand experience of how they really respond is obviously 
better.  In any event, just asking as you mention App Server's....

--Nikolaos



Rick Grashel wrote:
> Joaquin,
>
> Also, if you aren't already using one, you might consider using an 
> application server that has connection pooling facilities.  Websphere 
> Community Edition/Geronimo, Glassfish, JBoss.  All of these have 
> built-in connection pool capabilities so you don't have to do this in 
> your code or project configuration.  Also, just in case you are, I'd 
> recommend not using native hibernate.  Instead, you can keep your code 
> much more standard by using Hibernate as a JPA provider.
>
> Most times, it is better left to the container to provide you with 
> these kinds of core services/facilities.
>
> -- Rick
>
>
> On Wed, Sep 22, 2010 at 2:05 PM, Joaquin Valdez 
> <joaquinfval...@gmail.com <mailto:joaquinfval...@gmail.com>> wrote:
>
>     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
>     <mailto:Stripes-users@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> 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
>   


-- 
Nikolaos Giannopoulos
Director, BrightMinds Software Inc.
e. nikol...@brightminds.org
w. www.brightminds.org
t. 1.613.822.1700
c. 1.613.797.0036
f. 1.613.822.1915


------------------------------------------------------------------------------
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