• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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).
 
I am a man of mystery. Mostly because of this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic