Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 1353 invoked from network); 3 Feb 2003 18:38:07 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 3 Feb 2003 18:38:07 -0000 Received: (qmail 26955 invoked by uid 97); 3 Feb 2003 18:39:37 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 26948 invoked from network); 3 Feb 2003 18:39:37 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 3 Feb 2003 18:39:37 -0000 Received: (qmail 98533 invoked by uid 500); 3 Feb 2003 18:37:33 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 98495 invoked from network); 3 Feb 2003 18:37:33 -0000 Received: from studer.bol.com.br (200.221.24.21) by daedalus.apache.org with SMTP; 3 Feb 2003 18:37:33 -0000 Received: from www3 (200.221.24.99) by studer.bol.com.br (5.1.071) id 3E3CEC4900065A7A for tomcat-user@jakarta.apache.org; Mon, 3 Feb 2003 16:36:45 -0200 Message-ID: <002501c2cbac$970780e0$280a0a0a@lojas24horas.com.br> From: "Lindomar" To: "Tomcat Users List" References: Subject: Re: Datasource and connection Date: Mon, 3 Feb 2003 15:49:16 -0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4920.2300 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4920.2300 X-Sender-IP: 200.164.229.194 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N So so Sean. Then this is a way of tomcat implements the concept of connection pools. Right, i only wanted have certain. Thanks for all. ----- Original Message ----- From: "Sean Dockery" To: "Tomcat Users List" Sent: Monday, February 03, 2003 16:25 Subject: RE: Datasource and connection > I'm curious as to why you're asking this question. You should be using the > connection pool according to the documentation provided, because that is how > it is intended to be used. That is... > > void doPost(...) > { > InitialContext ic = new InitialContext(); > Context jdbcCtx = (Context) ic.lookup("java:comp/env"); > DataSource ds = (DataSource) jdbcCtx.lookup("jdbc/myDataSource"); > > Connection conn = null; > Statement stmt = null; > ResultSet rs = null; > > try { > conn = ds.getConnection(); > > stmt = ... > > rs = ... > } > catch(SQLException esql) { > } > finally { > if(rs != null) > rs.close(); > > if(stmt != null) > stmt.close(); > > if(conn != null) > conn.close(); > } > } > > What exactly are you THINKING of doing? > > -----Original Message----- > From: Lindomar [mailto:lindomar.silva@bol.com.br] > Sent: Monday, February 03, 2003 06:02 > To: Tomcat Users List > Subject: Datasource and connection > > > Hi everybody! > > I'm using datasource of tomcat for get connection. > Well, when i do this: > ... > DataSource ds = (DataSource)ctx.lookup( "java:comp/env/jdbc/Anything"); > if (ds != null) > connection = ds.getConnection(); > ... > > In the next time, will give tomcat to me a new connection or the same? > > I think that is same, but i didn't read anything about this. > > And when Tomcat close this connection? Only through the timeout? > > Thanks in advanced. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org