hi,
u have to close the connection, sothat container puts it back in the pool .
as u set maxActive="100" at max only 100 connections will be
maintained in pool and as u r not closing the connection, u would have
ran out of all the connections available in pool (ie 100)
closing the connection should solve ur problem
check this link for more details
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
regards
Srikanth Peddireddy
On 7/20/05, Tony Smith <quickcur@(protected):
> 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@(protected):
>
> >
> > 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@(protected)
> > For additional commands, e-mail:
> > tomcat-user-help@(protected)
> >
> >
>
>
> __________________________________________________
> 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@(protected)
> For additional commands, e-mail: tomcat-user-help@(protected)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)