• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic