• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access datasource in Quartz job running under Struts 1.x

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found a tutorial here http://www.mkyong.com/struts/struts-quartz-scheduler-integration-example/ on how to enable Quartz under Struts 1.x. It works like a charm with a few modifications for Quartz 2.1.

Now I get a "Hello World" in my logs.

However, I want to access the database inside my Job. How do I do that? How can I get hold of a Datasource object like I do inside an Action?

struts-config.xml


QuartzPlugin.java


SchedulerJob.java


SchedulerTask.java
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you talking about the Struts Datasource? That was retired in Struts 1.2.7. Since Struts is an implementation of the Front Controller Pattern, it didn't make sense to manage "back end" resources like database connections. There is no way to access a Struts Datasource outside the Struts web app.
Depending on your servlet container, you may be able to configure a database pool to be available to outside processes (Weblogic can, Tomcat cannot).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic