Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code needs to run on Tomcat startup. HELP PLZ!!

Status
Not open for further replies.

choppeliver

Programmer
Oct 9, 2003
1
US
When tomcat is started , i need it to automatically connect to my database and purge some information.... Where would i put this code? Is it possible?
 
Have a servlet which is mapped in web.xml with a <load-on-startup> tag - when tomcat starts this servlet will be loaded. If you put in the servlet the stuff you wish to perform in the init() method, this will get run on tomcat startup ...
 
What platform are you running?
If its Linux then just call your db script from within your &quot;tomcat4 start&quot; script?

Good Luck,
Laurie.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top