Really,

I have looked in web.xml and I can't seem to locate anything that is related
to database connections. The only settings related to connections that I can
see are related to JDBC realms.

-----Original Message-----
From: Arnab Chakravarty [mailto:[EMAIL PROTECTED]
Sent: 03 March, 2004 11:53 AM
To: Tomcat Users List
Subject: RE: OracleConnectionPoolDataSource creates too many connections


Possible problems could be:

- Connnections not getting closed
- The max concurrent request for tomcat had been reached (check the number
of connections in server.xml)

- AC

-----Original Message-----
From: Rudi Doku [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 03, 2004 2:34 PM
To: Tomcat Users List
Subject: OracleConnectionPoolDataSource creates too many connections
Importance: High


Hi All,

My web application is using up all connections after running for a while.
It's quite obvious that I'm not using the connection pool as it was designed
to be used. The only way I can get these connections back is by restarting
the Tomcat. I have ojdbc14.jar in the following directories:
$CATALINA_HOME/commons/lib directory &
$CATALINA_HOME/webapps/<myWebApp>/WEB-INF/lib.

This code creates my connection Pool
------------------------------------

   private void createConnectionPool(  ) {
      try {

        // Create a OracleConnectionPoolDataSource instance.
        connectionPoolDS = new OracleConnectionPoolDataSource(  );

        String url = "jdbc:oracle:thin:@194.26.151.17:1521:mosaic";

        connectionPoolDS.setURL( url );

        // Set the user name.
        connectionPoolDS.setUser("mosaicuser");

        // Set the password.
        connectionPoolDS.setPassword("mosa1c");

      }
       catch ( SQLException ex ) { // Catch SQL errors.
        //context.log( ex.toString(  ) ); // log errors.
      }
    }


This code creates a PooledConnection.
-------------------------------------

    public static synchronized PooledConnection getPooledConnection(){
        try{
            pooledconn = connectionPoolDS.getPooledConnection();

        }catch(SQLException sqle){
            sqle.printStackTrace();
        }
        return pooledconn;
    }

In my LoginServlet, I create a new PooledConnection, which I add to the
Servlet Context:

PooledConnection pc = ConnectionFactory.getInstance.getPooledConnection();
ServletContext ctx = getServletContext();
ctx.setAttribute("pooled_conn", pc);

On an JSP Page:
ServletContext ctx = getServletContext();
PooledConnection pc = (PooledConnection)ctx.getAttribute("pooled_conn");

Connection con = pc.getConnection
//do a few things with the connection

try{
    if (con != null){
        con.close();
    } // I'm assumingthis returns the connection to the Pool

}catch(SQLException sqle){
    sqle.printStackTrace();
}

Any help to solve this mystery would be very much appreciated.

Kind Regards,

Rudi




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to