Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 53267 invoked from network); 4 Sep 2005 18:24:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Sep 2005 18:24:32 -0000 Received: (qmail 62451 invoked by uid 500); 4 Sep 2005 18:24:28 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 62433 invoked by uid 500); 4 Sep 2005 18:24:27 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 62420 invoked by uid 99); 4 Sep 2005 18:24:27 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Sep 2005 11:24:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of Alexander.Rupsch@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 04 Sep 2005 11:24:39 -0700 Received: (qmail invoked by alias); 04 Sep 2005 18:24:19 -0000 Received: from 1Cust55.tnt11.ber2.deu.da.uu.net (EHLO [149.225.216.55]) [149.225.216.55] by mail.gmx.net (mp006) with SMTP; 04 Sep 2005 20:24:19 +0200 X-Authenticated: #13607427 Message-ID: <431B3B64.4060005@gmx.de> Date: Sun, 04 Sep 2005 20:22:28 +0200 From: Alexander Rupsch User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: stmt.getConnection() != Connection used to create the statement References: <430259E8.5040003@gmx.de> <43031D13.1080904@c1-fse.de> <4303A69D.7010405@gmx.de> <4309BC9F.1000006@c1-fse.de> In-Reply-To: <4309BC9F.1000006@c1-fse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello Alexander, > Yes, you have to do it. I can't tell about a specific standardization > document, but I think it's a best practice of pool implementors to rely > on users to close connections explicitly. The reason is that you can use > connections from pools for more than one statement, thus, you have to > close it in order to allow the pool to determine if that connection can > be reused. Well, I know. But if I ask a statement for its creating connection (stmt.getConnection()) and then then call close on that connection, the connection won't be closed (at least not the one I used to call createStatment()). So, what does the close call do in that constellation? what is closed/returned to the pool? > What is your problem with remembering the reference to the connection? Nothing in common. I have a BaseDAO class which is used as base for my DAOs. The DAOs are generated. To simplify my generator template there is a method createPreparedStatement() which is getting a connection an creates a prepared statement. The method always ask the pool for a connection. The specific DAO uses a standard cleanup which closes the statement and the its creating connection. After changing to dbcp as pool implementation, i run into the problem described above. Apart from the fact, that the DAO only should to worry about the statement if it only gets a statement, I wanted to know why pools don't implement stmt.getConnection() in the way the JDBC-API claims it. >>I also could take a look in the statement pooling feature and don't even >>use a connection., but this wouldn't clarify the problem. > Sorry, I don't get what you mean here .... ? Statement pooling is a feature of dbcp, but I never used it until know and I don't know how it works. If statement pooling would do what its name says, it could be a solution for me. But this wouldn't answer my question. regards... -- Alexander Rupsch http://www.dreinhalb.de --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org