Hi folks,

Here's my situation, I am using tomcat(latest version) and
mysql,jdbc(mysql ..connector..jar) and struts for an application with
connection pooling.  I can not figure out why my connection stay around
once I close them, they are not sent back to the pool.

I create a connection then I 

                Connection myConnection = utilclass.getDbConnection();

the getDBconnetion() method is here:

        public Connection getDbConnection() {
                String contextString = "java:comp/env/jdbc/cms";
                Connection localConnection = null;
                DataSource myBasicDataSource = null;

                try {
                        Context myContext = new InitialContext();
                        myBasicDataSource = (DataSource)
myContext.lookup(contextString);
                        localConnection =
myBasicDataSource.getConnection();
                }
                   ..................return localConnection;


I use the connection for a statement and a result set.

I close the connection
                         myConnection .close();

I have also found out that you should be closing the result set and the
statement also, which I have tried but that did not resolve my problem. 
When I check out the DB I see the connections that are created during
the application but they remain there in sleep until tomcat is
shutdown.

I have added the following to my server.xml to clean up connections

              <name>removeAbandoned</name>
              <value>true</value>
            </parameter>
            <parameter>
              <name>removeAbandonedTimeout</name>
              <value>10</value>
            </parameter>
            <parameter>
              <name>logAbandoned</name>
              <value>true</value>
            </parameter>

but this does not seem to work, I added it in the jdbc resource params
section.  Is there a way to clean up these connections that are lying
around.  I connect many times to the db and I thought that in the end of
things I should only have one connection left, all the other connections
were closed but not reclaimed.

I could really use some help on this one.

Thanks 

Scott




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

Reply via email to