the fragment code below describe how I acquire and close ressource.

protected void executeDB() throws TechnicalException
        {
                Connection connection = null;
                Statement statement = null;

                connection = getConnection();

                try
                {
                        statement = connection.createStatement();
                        executeTransaction(statement);

                }
                catch (SQLException e1)
                {
                        throw new TechnicalException(this, "Probleme d'acc�s � la base 
de donn�e impossible de cr�er un objet
Statement " + e1.getMessage());

                }

                finally
                {
                        // on libere les ressources
                        release(connection, statement);
                        sqlQueries = new ArrayList();
                }

        }


the getConnection() method will acquire a connection defined in server.xml
file
while the release connection will close ressources.

Meissa Sakho
NATEXIS ASSET MANAGEMENT
Direction de l'organisation
Tel. : 01 58 19 45 71
http://www.assetmanagement.natexis.fr





Kwok Peng Tuck <[EMAIL PROTECTED]>
07/11/2003 09:08
Veuillez r�pondre � "Jakarta Commons Users List"


        Pour :  Jakarta Commons Users List <[EMAIL PROTECTED]>
        cc :
        Objet : Re: R�f. : Re: R�f. : RE: dbcp size nightmare


Uh, sorry, I didn't quite get that. Could you include your code for us
to see ?


[EMAIL PROTECTED] wrote:

>better,
>Im closing in my finally statement all resources.
>
>Resultset,statement and connection.
>
>Meissa Sakho
>NATEXIS ASSET MANAGEMENT
>Direction de l'organisation
>Tel. : 01 58 19 45 71
>http://www.assetmanagement.natexis.fr
>
>
>
>
>
>Kwok Peng Tuck <[EMAIL PROTECTED]>
>07/11/2003 08:22
>Veuillez r�pondre � "Jakarta Commons Users List"
>
>
>
>        Pour :  Jakarta Commons Users List
<[EMAIL PROTECTED]>
>        cc :
>
>        Objet : Re: R�f. : RE: dbcp size nightmare
>
>
>Make sure that you include a finally block after your catch, in which
>
>you actually close the connection.
>
>try {
>    //Do your db con here.
>
>}catch (SQLException e) {
>    e.printStackTrace() ;
>}finally {
>     try {
>          if(con!=null) { con.close() ;  }
>    }catch (SQLException e) {
>       e.printStackTrace() ;
>    }
>}
>
>You can find this design pattern in the tomcat doc as well (under JNDI
>
>datasource how-to)  .
>
>
>[EMAIL PROTECTED] wrote:
>
>
>
>>I do close everything.
>>I'm wondering if it's not because I don't specify a factory
>>in the pool config.
>>
>>any other suggestion ...
>>
>>
>>
>>Meissa Sakho
>>NATEXIS ASSET MANAGEMENT
>>Direction de l'organisation
>>Tel. : 01 58 19 45 71
>>http://www.assetmanagement.natexis.fr
>>
>>
>>
>>
>>
>>"Michael Holly" <[EMAIL PROTECTED]>
>>06/11/2003 17:31
>>Veuillez r�pondre � "Jakarta Commons Users List"
>>
>>
>>
>>       Pour :  "'Jakarta Commons Users List'"
>>
>>
>
><[EMAIL PROTECTED]>
>
>
>>       cc :
>>
>>       Objet : RE: dbcp size nightmare
>>
>>
>>Make sure you are closing all your resources after running the SQL.
>>Connection, Statement, ResultSet.
>>
>>
>>Michael Holly
>>
>>"Developing Software from requirements and Walking on water, both are
>>easy when frozen."
>>"Good, Fast, and Cheap... pick Two"
>>
>>
>>
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED]
>>
>>Sent: Thursday, November 06, 2003 7:11 AM
>>To: [EMAIL PROTECTED]
>>Subject: dbcp size nightmare
>>
>>
>>
>>hi all,
>>
>>I have configured my dbcp connection pool like the fragment below.
>>
>><Resource name="jdbc/recProduit" auth="Container"
>>                       type="javax.sql.DataSource"/>
>>
>>
>>
>>           <ResourceParams name="jdbc/recProduit">
>><parameter><name>username</name><value>mailer</value></parameter>
>><parameter><name>password</name><value>mail2002</value></parameter>
>>
>>
>><parameter><name>maxActive</name><value>3</value></parameter>
>>           <parameter><name>driverClassName</name>
>>             <value>com.sybase.jdbc2.jdbc.SybDriver</value></parameter>
>>           <parameter><name>url</name>
>>
>>
>><value>jdbc:sybase:Tds:s198000BLAHBLAH:5000/intranet_mail</value></param
>>eter>
>>
>>
>>
>>         </ResourceParams>
>>
>>
>>
>>I don't know why, but the pool size is always increasing.
>>
>>
>>
>>I've tried the maxActive parameter unsucessfully.
>>
>>I've search the list before posting this question.
>>But I've found no cure to my problem.
>>
>>Any help to detect what's missing in my config would
>>be greetly appreciated.
>>
>>Meissa
>>
>>Meissa Sakho
>>NATEXIS ASSET MANAGEMENT
>>Direction de l'organisation
>>Tel. : 01 58 19 45 71
>>http://www.assetmanagement.natexis.fr
>>
>>
>>L'integrite de ce message n'etant pas assuree sur internet, Natexis
>>Banques Populaires ne peut etre tenu responsable de son contenu. Toute
>>utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas
>>destinataire de ce message, merci de le detruire et d'avertir
>>l'expediteur.
>>
>>The integrity of this message cannot be guaranteed
>>on the Internet. Natexis Banques Populaires can not therefore be
>>considered responsible for the contents.Any unauthorized use or
>>dissemination is prohibited. If you are not the intended recipient of
>>this message, then please delete it and
>>
>>notify the sender.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>>
>>L'integrite de ce message n'etant pas assuree sur internet, Natexis
>>Banques Populaires ne peut etre tenu responsable de
>>son contenu. Toute utilisation ou diffusion non autorisee est
>>interdite. Si vous n'etes pas destinataire de ce message, merci de le
>>detruire et d'avertir l'expediteur.
>>
>>The integrity of this message cannot be guaranteed
>>on the Internet. Natexis Banques Populaires can not therefore be
>>considered responsible for the contents.Any unauthorized use or
>>
>>
>
>dissemination is prohibited.
>
>
>>If you are not the intended recipient of this message, then please
delete
>>
>>
>
>it and
>
>
>>notify the sender.
>>
>>
>>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>L'integrite de ce message n'etant pas assuree sur internet, Natexis
>Banques Populaires ne peut etre tenu responsable de
>son contenu. Toute utilisation ou diffusion non autorisee est
>interdite. Si vous n'etes pas destinataire de ce message, merci de le
>detruire et d'avertir l'expediteur.
>
>The integrity of this message cannot be guaranteed
>on the Internet. Natexis Banques Populaires can not therefore be
>considered responsible for the contents.Any unauthorized use or
dissemination is prohibited.
>If you are not the intended recipient of this message, then please delete
it and
>
>notify the sender.
>
>


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





L'integrite de ce message n'etant pas assuree sur internet, Natexis
Banques Populaires ne peut etre tenu responsable de
son contenu. Toute utilisation ou diffusion non autorisee est
interdite. Si vous n'etes pas destinataire de ce message, merci de le
detruire et d'avertir l'expediteur.

The integrity of this message cannot be guaranteed
on the Internet. Natexis Banques Populaires can not therefore be
considered responsible for the contents.Any unauthorized use or dissemination is 
prohibited.
If you are not the intended recipient of this message, then please delete it and
notify the sender.

Reply via email to