Probably you are not closing all the objects. It depends on pool used and
app server but is a good idea (and more portable) to close all the
objects. Many pools crash if you only close (return) the connections.

after using the rs object (ResultSet) --> rs.close()
after using the st object (Statement) --> st.close()
after using the pst object (PreparedStatement) --> pst.close()
after using ... (all the jdbc objects)

You must close, to avoid errors, in reverse order as they were
instantiated.

Try it, i have no read your code and could be other problems.

Hope this help
Marcos



-----Mensaje original-----
De: Rudi Doku [mailto:[EMAIL PROTECTED] 
Enviado el: miércoles, 03 de marzo de 2004 10:04
Para: Tomcat Users List
Asunto: OracleConnectionPoolDataSource creates too many connections
Importancia: Alta


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]


******************AVISO LEGAL******************

Este mensaje es privado y confidencial y solamente para la persona a la
que va dirigido. Si usted ha recibido este mensaje por error, no debe
revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo
comunique al remitente y borre dicho mensaje y cualquier documento
adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a
ningún privilegio por causa de transmisión errónea o mal funcionamiento.
Cualquier opinión expresada en este mensaje pertenece únicamente al autor
remitente, y no representa necesariamente la opinión de Santander Central
Hispano, a no ser que expresamente se diga y el remitente esté autorizado
para hacerlo.
Los correos electrónicos no son seguros, no garantizan la
confidencialidad ni la correcta recepción de los mismos, dado que pueden
ser interceptados, manipulados, destruidos, llegar con demora,
incompletos, o con virus. Santander Central Hispano no se hace
responsable de las alteraciones que pudieran hacerse al mensaje una vez
enviado.
Este mensaje sólo tiene una finalidad de información, y no debe
interpretarse como una oferta de venta o de compra de valores ni de
instrumentos financieros relacionados. En el caso de que el destinatario
de este mensaje no consintiera la utilización del correo electrónico via
Internet, rogamos lo ponga en nuestro conocimiento.

******************DISCLAIMER******************
This message is private and confidential and it is intended exclusively
for the addressee. If you receive this message by mistake, you should not
disseminate, distribute or copy this e-mail. Please inform the sender and
delete the message and attachments from your system. No confidentiality
nor any privilege regarding the information is waived or lost by any
mistransmission or malfunction.
Any views or opinions contained in this message are solely those of the
author, and do not necessarily represent those of Santander Central
Hispano, unless otherwise specifically stated and the sender is
authorised to do so.
E-mail transmission cannot be guaranteed to be secure, confidential, or
error-free, as information could be intercepted, corrupted, lost,
destroyed, arrive late, incomplete, or contain viruses. Santander Central
Hispano does not accept responsibility for any changes in the contents of
this message after it has been sent.
This message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments. If the addressee of this message does not
consent to the use of internet e-mail, please communicate it to us.


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

Reply via email to