tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alon Belman <alon.bel...@gmail.com>
Subject Re: Connection pool exhausted
Date Tue, 19 Jul 2005 23:27:39 GMT
If you arent closing connections, then exhausting the connection pool
is the expected, eventual result.

Read the document at
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html,
paying special attention to the "example of properly written code
[using] a db connection obtained from a connection pool" near the
bottom of the page.




On 7/19/05, Tony Smith <quickcur@yahoo.com> wrote:
> I am runing tomcat 5.0 + postgresql. I set my
> connection pool in server.xml as:
> 
>     <Resource
>       name="jdbc/mysource"
>       type="javax.sql.DataSource"
>       password="xxxx"
>       driverClassName="org.postgresql.Driver"
>       maxIdle="100"
>       maxWait="5000"
>       validationQuery="select * from test"
>       username="xxxx"
>       url="jdbc:postgresql://localhost:5432/mydb"
>       maxActive="100"/>
> 
> I call it from my servlet as:
> 
> public Connection getConnection(){
>         try{
>             Context initCtx = new InitialContext();
>             Context envCtx =
> (Context)initCtx.lookup("java:comp/env");
>                 DataSource ds =
> (DataSource)envCtx.lookup("jdbc/mysource");
>                 DatabaseManager.initDataSource(ds);
>                 return ds.getConnection();
>             }catch(Exception e){
>             e.printStackTrace();
>         }
> 
>     return null;
> }
> 
> 
> I use the connection as:
> 
> Connection connection = getConnection();
> 
> ....//jdbc
> 
> //I did not call connection.close(). Should I?
> 
> Then, I can run my web app. But not for long. I got
> the following exception after browse a few pages:
> 
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> get a connection, pool exhausted
> 
> 
> How can I fix it?
> 
> Thanks,
> 
> 
> 
> 
> 
> --- skausl <skausl@gmx.de> wrote:
> 
> >
> > I have log4j-1.2.11.jar in Tomcat\common\lib and
> > log4j.properties in
> > Tomcat\common\classes\.
> >
> > > -----Original Message-----
> > > Sorry if this is an oft-repeated question.
> > Digging through
> > > old archives
> > > of this list and Google haven't turned up anything
> > directly related.
> > >
> > > I'm trying to run Tomcat 5.5.9 as a windows
> > service
> > > (installed it using
> > > service.bat), but for some unknown reason, it does
> > not pick up the
> > > log4j.properties files located in my applications
> > WEB-INF\classes
> > > directory.  As far as I can tell, the java
> > options, classpath and
> > > startup class are identical for both.  Is this a
> > > limitation/weakness of
> > > the Windows Service or do I have something
> > mis-configured?
> > >
> > > Thank You.
> > > Brian
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> >
> >
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message