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 <[EMAIL PROTECTED]> 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:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]