Hi all,

I have seen a strange behaviour with the new Tomcat jdbc-pool (1.0.7.1).
It seems to ignore the minIdle parameter.
I have been able to reproduce it with a simple program.
minIdle is set to 5 and after a few seconds, I don't have any idle connection left.
Could anybody confirm the bug or point the mistake in my configuration ?
Thanks in advance.
Best regards,
Xavier.

Here is the test program :

public class TestPool {
        public static void main(String[] args) throws Exception {
                PoolProperties p = new PoolProperties();
                p.setUrl("jdbc:postgresql:XXX");
                p.setDriverClassName("org.postgresql.Driver");
                p.setUsername("login");
                p.setPassword("password");
                p.setDefaultAutoCommit(false);
                p.setJmxEnabled(false);
                p.setTestWhileIdle(true);
                p.setTestOnBorrow(true);
                p.setValidationQuery("SELECT 1");
                p.setTestOnReturn(false);
                p.setMaxActive(30);
                p.setInitialSize(5);
                p.setMaxWait(200000);
                p.setMaxAge(43200);
                p.setMinIdle(5);
                p.setMaxIdle(15);
                p.setLogAbandoned(true);
                p.setRemoveAbandoned(true);
                p.setRemoveAbandonedTimeout(300);
                p.setJdbcInterceptors("StatementFinalizer;ResetAbandonedTimer");

                DataSource datasource = new DataSource();
                datasource.setPoolProperties(p);
                Connection con = null;
                try {
                        while(true){
                                con = datasource.getConnection();
                                Statement st = con.createStatement();
                                ResultSet rs = st.executeQuery("select count(*) from 
users");
                                rs.close();
                                st.close();
                                System.out.println("Pool size : " 
+datasource.getSize());
                                System.out.println("Idle : " 
+datasource.getIdle());
                                System.out.println("Active : " 
+datasource.getActive());
                                con.close();
                                Thread.sleep(1000);
                        }
                } finally {
                        if (con!=null) try {con.close();}catch (Exception 
ignore) {}
                }
        }
}


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

Reply via email to