Re: Connection Pooling (How i use...)

2004-04-07 Thread Larry Meadors
Depends on your situation. If the SQL Exceptions are expected (i.e., a trigger could fail) then yes, you will want to catch that and send the message back to the user. However, if you are thinking JDBC is the way to go, you really should use something like iBATIS that hides this kind of stuff fr

Re: Connection Pooling (How i use...)

2004-04-07 Thread Marcelo Epstein
ED]> > Data: Wed, 07 Apr 2004 09:00:16 -0400 > Para: Struts Users Mailing List <[EMAIL PROTECTED]> > Assunto: Re: Connection Pooling (How i use...) > > So, are there implied catches in there for SQLException (I assume there > are)? > In the innermost try block, does t

Re: Connection Pooling (How i use...)

2004-04-07 Thread Dean A. Hoover
So, are there implied catches in there for SQLException (I assume there are)? In the innermost try block, does the catch rethrow the SQLException so that it cascades to the outer blocks? Just trying to understand the model. Dean Hoover Larry Meadors wrote: Yes. You really might want to consi

SV: Connection Pooling (How i use...)

2004-04-06 Thread hermod . opstvedt
List Emne: Re: Connection Pooling (How i use...) I use the pool like this: (IS IT WRONG??) I think the connection is being closed.. try { Context ctx = new InitialContext(); if (ctx == null) throw new Exception("Boom - No Context"); Dat

RE: Connection Pooling (How i use...)

2004-04-06 Thread Navjot Singh
See this Connection conn = null; try{ conn = ds.getConnection(); ...whatever you wish to do with conn.. catch(SQLException sqle) { action of exception } finally{ try{ if(nul != conn) conn.close(); } catch(SQLException sqle){ action of except

Re: Connection Pooling (How i use...)

2004-04-06 Thread Larry Meadors
Uhh, yeah, I never did that, no, I just heard about it...yeah, that's it... ;-) >>> [EMAIL PROTECTED] 04/06/04 11:45 AM >>> *Quite* right: there was one time we had set the autoCommit on the connection object to false, forgotten to change it back before releasing it to the pool andwell,all

Re: Connection Pooling (How i use...)

2004-04-06 Thread Geeta Ramani
*Quite* right: there was one time we had set the autoCommit on the connection object to false, forgotten to change it back before releasing it to the pool andwell,all I can say is we spent some "interesting" hours trying to debug that one! Geeta Larry Meadors wrote: > Yes. > > So be careful

Re: Connection Pooling (How i use...)

2004-04-06 Thread Larry Meadors
Oh yeah, that reminds me: Be careful not to double close your connections - with some implementations, that closes the pool. So do not close the connectionin the try *and* in the finally - do it *only* in the finally! Larry >>> [EMAIL PROTECTED] 04/06/04 11:25 AM >>> well, you are right...! Wh

Re: Connection Pooling (How i use...)

2004-04-06 Thread Geeta Ramani
Ah, well, you didn't read the fine print: -->>Note: this code isn't anywhere near production ready - it's only supposed to be used as a simple test :-) Believe me, you should close connections/return them to the pool in a finally block if you want to avoid major problems.. As I said before, thi

Re: Connection Pooling (How i use...)

2004-04-06 Thread Larry Meadors
I have yet to see a *good* example of how to do jdbc on the net. Most are very simple one-off "throws SQLException" examples that don't seem to take into consideration little things like stability and releasing resources. :) That is why I think tools like iBATIS are so powerful - you get all the

RE: Connection Pooling (How i use...)

2004-04-06 Thread Larry Meadors
Yes. So be careful if you tweak the connection (like changing transaction isolation, etc) because that connection may be used elsewhere, and your change will persist. :) Larry >>> [EMAIL PROTECTED] 04/06/04 11:17 AM >>> What happens when i do conn.close()? does it go back to the pool? ---

Re: Connection Pooling (How i use...)

2004-04-06 Thread Geeta Ramani
To: Struts Users Mailing List > Cc: > Subject: Re: Connection Pooling (How i use...) > > > > This your problem: closing the connection in your try block. Move it to a > finally block.. > > Marcelo Epstein wrote: > >

Re: Connection Pooling (How i use...)

2004-04-06 Thread Mark Lowe
g getFoo() { return foo; } public int getBar() { return bar;} } On Tue, 06 Apr 2004 12:50:29 -0400, "Geeta Ramani" <[EMAIL PROTECTED]> escreveu: De: "Geeta Ramani" <[EMAIL PROTECTED]> Data: Tue, 06 Apr 2004 12:50:29 -0400 Para: Struts Users Mailing List <[EMAIL PROTE

Re: Connection Pooling (How i use...)

2004-04-06 Thread Marcelo Epstein
} public String getFoo() { return foo; } public int getBar() { return bar;} } On Tue, 06 Apr 2004 12:50:29 -0400, "Geeta Ramani" <[EMAIL PROTECTED]> escreveu: > De: "Geeta Ramani" <[EMAIL PROTECTED]> > Data: Tue, 06 Apr 2004 12:50:29 -0400 > Para:

RE: Connection Pooling (How i use...)

2004-04-06 Thread Vijay.Nair
] Sent: Tue 4/6/2004 10:20 PM To: Struts Users Mailing List Cc: Subject: Re: Connection Pooling (How i use...) This your problem: closing the connection in your try block. Move it to a finally block.. Marcelo Epstein wrote

Re: Connection Pooling (How i use...)

2004-04-06 Thread Geeta Ramani
This your problem: closing the connection in your try block. Move it to a finally block.. Marcelo Epstein wrote: > I use the pool like this: (IS IT WRONG??) I think the connection is being closed.. > > try { > Context ctx = new InitialContext(); > if (ctx == null) >

Re: Connection Pooling (How i use...)

2004-04-06 Thread Paul Barry
From: Marcelo Epstein [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 9:31 AM To: Struts Users Mailing List Subject: Re: Connection Pooling (How i use...) I use the pool like this: (IS IT WRONG??) I think the connection is being closed.. try { Context ctx = new InitialContext();

Re: Connection Pooling (How i use...)

2004-04-06 Thread Larry Meadors
Yes. You really might want to consider a tool like iBATIS, but if you want to do it yourself, here is the pattern: Connection c = null; try{ //get connection try{ // get statement try{ // get result set // process result set }finally{ // close result set if not

RE: Connection Pooling (How i use...)

2004-04-06 Thread McClung, Brian
) and always in a finally block. Brian McClung Senior Programmer Belo Interactive -Original Message- From: Marcelo Epstein [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 11:31 AM To: Struts Users Mailing List Subject: Re: Connection Pooling (How i use...) I use the pool like

RE: Connection Pooling (How i use...)

2004-04-06 Thread Avinash Gangadharan
http://proxool.sourceforge.net/ Avinash -Original Message- From: Marcelo Epstein [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 9:31 AM To: Struts Users Mailing List Subject: Re: Connection Pooling (How i use...) I use the pool like this: (IS IT WRONG??) I think the connection is being closed..

Re: Connection Pooling (How i use...)

2004-04-06 Thread Paul Barry
Yes, you need to put the conn.close() in a finally, something like this Connection conn = null; try { ... conn = ds.getConnection(); ... } catch(Exception ex) { } finally { try { conn.close(); } catch(Exception ex) { System.err.println(ex); } } In your way, if

Re: Connection Pooling (How i use...)

2004-04-06 Thread Marcelo Epstein
I use the pool like this: (IS IT WRONG??) I think the connection is being closed.. try { Context ctx = new InitialContext(); if (ctx == null) throw new Exception("Boom - No Context"); DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/EasyDB");