X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A351552965 for ; Wed, 11 May 2005 19:53:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08352-04 for ; Wed, 11 May 2005 22:53:45 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by svr1.postgresql.org (Postfix) with ESMTP id 8F28753B6D for ; Wed, 11 May 2005 19:53:44 -0300 (ADT) Received: from [192.168.0.2] (pcp981067pcs.northw01.in.comcast.net[68.58.67.8]) by comcast.net (sccrmhc11) with ESMTP id <20050511225342011000ische>; Wed, 11 May 2005 22:53:47 +0000 Message-ID: <42828CF9.5070008@comcast.net> Date: Wed, 11 May 2005 17:53:45 -0500 From: Warren Killian User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: PostgreSQL/Tomcat JNDI Datasource Questions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.266 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FROM_ENDS_IN_NUMS X-Spam-Level: ** X-Archive-Number: 200505/53 X-Sequence-Number: 12884 Hello group, I have several questions concerning configuring and using a JNDI DataSource with PostgreSQL and Apache Tomcat. Currently I have successfully configured a "basic" DataSource. Currently, my configuration which resides in a context.xml file is as follows: factory org.apache.commons.dbcp.BasicDataSourceFactory driverClassName org.postgresql.Driver url jdbc:postgresql://myIP/test username Whoopie password Doopie removeAbandoned true removeAbandonedTimeout 20 maxWait 5000 maxActive 5 maxIdle 2 validationQuery SELECT * FROM test Using the above configuration, my JSP pages can connect to PostgreSQL and perform all required database operations. But all is not right! I have the following issues: 1.) Connections are NEVER closed Say I hit my JSP page which perform a query and display the results. Using netstat I can see that one connection to PostgreSQL has been established. But then, if I uninstall and reinstall my web app and hit my JSP page again, then the output of "netstat -p -t" shows that a second connection to PostgreSQL is established. The first connection never goes away! If I continue to uninstall/reinstall/hit JSP page, the connections continue to acrue and never go away. The number of connections can even exceed the value of "maxActive" defined in my context.xml file. What am I doing wrong? 2.) Idle connections aren't closed As mentioned above, the connections which are opened by my web app are kept around forever and never closed. In my context.xml file above, I've defined the "removeAbandoned" parameter to true and have set the "removeAbandonedTimeout" parameter to 20 seconds. But the connections are never closed. Every time I run "netstat -p -t", the connections are still there. :( 3.) Is my configuration correct for performing Pooling? I "can" get "a" database connection using this configuration. But is this adequate to perform connection pooling? How can I tell if/when connection pooling is actually being performed correctly? Any help would be greatly appreciated. -- Thank you, Warren Killian warrenk19@comcast.net Q: How many Zen masters does it take to screw in a light bulb? A: None. The universe spins the bulb and the Zen master stays out of the way.