Chris

Their is only one connection pool used for the system and that's the one
defined in context.xml.

Out of interest, I include the code of the connection pool class being used:

package myDataSharer.database_access;

import java.sql.*;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import org.apache.log4j.Logger;

public class ConnectionPool_DBA {

    static Logger logger =
Logger.getLogger(ConnectionPool_DBA.class.getName());

    private static ConnectionPool_DBA pool = null;
    private static DataSource dataSource = null;
    

    public synchronized static ConnectionPool_DBA getInstance() {
        if (pool == null) {
            pool = new ConnectionPool_DBA();
        }
        return pool;
    }

    private ConnectionPool_DBA() {
        try {
            InitialContext ic = new InitialContext();
            dataSource = (DataSource)
ic.lookup("java:/comp/env/jdbc/myDataSharer");
        }
        catch(Exception ex) {
            logger.error("Error getting a connection pool's datasource\n",
ex);
        }
    }

    public void freeConnection(Connection c) {
        try {
            c.close();
        }
        catch (Exception ex) {
            logger.error("Error terminating a connection pool connection\n",
ex);           
        }
    }
    
    public Connection getConnection() {
        try {
            return dataSource.getConnection();
        }
        catch (Exception ex) {
            logger.error("Error getting a connection pool connection\n",
ex);            
            return null;
        }
    }    
}

This should be read in tandem with the code I posted yesterday illustrating
a typical database operation.

How do I switch query logging on though?

Thanks

Martin O'Shea.

Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Martin,
> 
> On 10/1/2009 3:47 AM, MartinOShea wrote:
>> Changing  testOnBorrow = "true" has not changed the situation with the
>> connection pool failing  -can anyone suggest anything?
> 
> Are you sure you are configuring the right connection pool?
> 
> Can you turn-on query logging on the server and observe what queries are
> being executing when?
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkrE04oACgkQ9CaO5/Lv0PBLTwCeMjZGg/2Y14BPwiTjXLvnPhU0
> SY4An2bjLBYUnCCWjEN/dsBnsEd8vIHA
> =vhEb
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Tomcat-6.X-and-MySQL-connection-pooling-issue-tp25677820p25702523.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to