aspose file tools*
The moose likes Servlets and the fly likes ResultSet, Statement Caching In Tomcat, Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ResultSet, Statement Caching In Tomcat, Servlets" Watch "ResultSet, Statement Caching In Tomcat, Servlets" New topic
Author

ResultSet, Statement Caching In Tomcat, Servlets

Vikas Aggarwal
Ranch Hand

Joined: Jun 22, 2001
Posts: 140
Hi,
Hitting the server and database for same kind of data involves the use of same Statements and use of same ResultSets over and over again.
I want to run the queries at the server start up and store tha data somewhere on application level so that it can be accessible to all of the servlets. Also this method should also avoid the concurrency issues.
Thanks for your help.


Vikas Aggarwal

Founder @
Leads and Deals Limited

www.LeadsAndDeals.com
Ken Robinson
Ranch Hand

Joined: Jul 25, 2002
Posts: 52
If you just want to get a Collection of rows at startup and never refresh them, that is quite easy.
Create a Bean to hold a row of data. During startup of the app (via a Startup Servlet or ContextListener -2.3), run the query, build the Collection of Beans and put the Collection in the Servlet Context. Now it is available to all Servlet/Filters/JSP in the app.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: ResultSet, Statement Caching In Tomcat, Servlets
 
Similar Threads
j_security_check and weblogic
Very simple JMS ActiveMQ PTP interaction on Tomcat
Do EJBs use RMI?
Question about ServletContext
j_security_check and weblogic