I don't think of it as garbage. BTW, it is spelled "garbAge". thanks.
And now for an answer to the question : You want a static reference to a connection pool. The web has many, many references to this. Google on ConnectionPool jdbc. To start you off : -- read this first, it may be all that you need http://developer.java.sun.com/developer/technicalArticles/J2EE/pooling/ -- some nice explanatory texts http://www.crackinguniversity2000.it/Java/j-jdbc-a4.pdf http://csajsp-chapters.corewebprogramming.com/CSAJSP-Chapter18.pdf --- "[Your Full Name]" <[EMAIL PROTECTED]> wrote: > NO MORE GARBIGE MAIL > > thanks > > -----Original Message----- > From: Anoop Kumar V [mailto:[EMAIL PROTECTED]] > Sent: 16. lokakuuta 2002 10:59 > To: [EMAIL PROTECTED] > Subject: Connection to database from jsp. > > > > We have a system consisting of a group of jsps - which have links to one > another. There is no controller servlet as it is a simple system. What i > want is to access the database from the jsps. The problem is that I do not > want a new connection to be established everytime a request is made. What is > the solution for this? > > I had initially thought of having a utility class and in that I can have a > getConnection method which returns the connection to a static connection > reference in the same utility class. This can then be assigned to the jsps > (by making a call from the jsps to some method - returnConn, in the utilily > class). Is it true that a new connection will be established everytime. This > has confused me a bit. > > I am infact confused now about the very concept of static references. How do > you think this problem can be solved? Will a servlet be of any use? Actually > in a servlet, if we have a static connection reference as a class variable, > and the initialization is done ( acquiring a connection) in the init method > ( as init is executed only once in the lifetime of a servlet), the problem > may be solved. In a servlet, the init method is executed only once and the > servlet does not go out of memory till the server comes down. So I presume > the connection will also be the same. Is this correct? Even if it is, I want > to avoid the servlet, as it will be a lot of rework if the servlet has to be > fit in. The application would have to be changed. Suggestions invited. > > > Anoop Kumar V. > > > ===== Mark Zawadzki Performance Engineer/DBA/Programmer extraordinaire’ [EMAIL PROTECTED] [EMAIL PROTECTED] "Democracies die behind closed doors," - Judge Damon Keith __________________________________________________ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos & More http://faith.yahoo.com ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html