I wish it was that simple to just DO-IT-ALL-OVER-AGAIN.... but we're already in
production, I don't have the time to go trough all the classes again an rewrite
code... I have a lot of other things to do along with providing maintenance to all
these 100 classes...
Isn't there a way a class can have a connection and properly close it after it has
made use of it? Cuz that's the main problem here... the connections don't close...
only if I call con.close() in the same method that opens it... but that makes it too
slow...
And what about that "maximum cursors open" thing?? I call rs.close() and stmt.close()
in the finally block of EVERY query... how come I get maxium cursors???
.:| Christian J. Dechery
.:| FINEP - Depto. de Sistemas
.:| [EMAIL PROTECTED]
.:| (21) 2555-0332
>>> [EMAIL PROTECTED] 22/08/02 00:58 >>>
On Wed, 21 Aug 2002, Christian J. Dechery wrote:
> Date: Wed, 21 Aug 2002 16:56:05 -0300
> From: Christian J. Dechery <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: problems with Connections
>
> That's exactly the problem... we dont't have any servlets (I wish we had, but I
>didn't design, I only code)... only JSPs and classes...
>
> I'll give u an example of how are things here... let's say we have a class called
>BusinessObject, and a class called DAOBusinessObject...
>
> so I'd have a JSP like that
>
> <%
> BusinessObject bo = new BusinessObject(); // at this point, DAOBusinessObject
>requested a connection
> bo.method1(); // this method calls a method in DAO which runs a query
> bo.method2(); // this on too... and every other method as well...
> %>
> so, as long as the DAOBusinessObject object "lives" the Connection is
> there... how am I supposed to close it, since every query needs it? Now
> I see, I should have a method to close the used conn or something... but
> we have up to 50 DAO* classes and more then 200 JSPs...
>
> I agree with what u said about the finalize()... but what should I do then?
>
Give up and start over.
Seriously.
This application design is totally hopeless from a scalability or
reliability viewpoint, because it requires a connection for every business
object, on every page that uses that BO class. To say nothing of the fact
that JDBC drivers are not required to be thread safe, so you're
undoubtedly causing yourself tremendous grief when the same page is
accessed by more than one user.
If you follow my advice, please follow one other piece -- get a book on
design patterns ("Core J2EE Design Patterns" by Alur/Crupi/Malks is one of
my most well-thumbed resources) and follow the prescribed patterns for
doing this right.
>
> .:| Christian J. Dechery
> .:| FINEP - Depto. de Sistemas
> .:| [EMAIL PROTECTED]
> .:| (21) 2555-0332
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>