Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Scheduling Pls Help

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai
I want to update a database on a daily basis using java at some predefined times of the day. is this possible? What i am looking at is some kind of a cron job like facility like in linux.
Thanks
Bye
 
Ranch Hand
Posts: 1246
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just a idea,
have a cron runs a shell script which runs java program.
or just have a perl or shell script do it directly.
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For any UNIX system you can write a cron job as specifed in the previous reply. If u use windows NT then create a new scheduled task to invoke a batch file which invokes Java.
------------------
Shubhrajit
 
allen turner
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!
But i want to do it from java so that i need not depend on the facility given by the platform like NT or linux. if i can do it in java no matter waht the platform it will work!!. So i specifically need it in java.
Bye
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course you can do this, and event handling is the way to do it. Think about it this way: you have a Cron object (hey why not, the word's not copyrighted) that will tell other objects when a time they have expressed interest in comes around. When it happens, the Cron class creates a TimedEvent object, and sends it as a parameter to a Listener that knows what job needs to be performed.
For a task like this you don't really need OS services. Your VM does, of course, but that's already built into it.
Is that enough to go on?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
allen turner
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
I think i can work on that idea. Is there any useful jars that can do all this kind of things?
Thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Allen,
JDK1.3 exposes couple of classes java.util.Timer and java.util.TimerTask that actually does the job of Scheduling (It is rudimentary thread based implementation). It is pretty simple to build a robust client around Timer and TimerTask.
Hope this helps.
Chidda
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic