• 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

code that runs automatically to update sql tables on a specified date and time

 
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,

I want a servlet/jsp code that runs automatically to update sql tables on specified date and time as a background process to my application.

Thanks in advance
-Ilias
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Implement ServletContextListener and extend TimerTask.
 
ilias basha
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks friend, i was also having similar thought but i am unable to implement it in code, so can you please help me in that regard.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it have to be part of the web application? I've always implemented stuff like this in stand-alone daemon applications.
 
ilias basha
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,

Actually i am working in a banking project where i need a thread to run in background that will take care of deducting balances of the customer when the actual scheduled date for payment is matching with the system date.

Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ilias basha wrote:Thanks friend, i was also having similar thought but i am unable to implement it in code, so can you please help me in that regard.

Just start reading the API docs how/what to implement.
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContextListener.html
http://java.sun.com/javase/6/docs/api/java/util/TimerTask.html

By the way, is it a serious banking project or just some school project? Honestly, it would really astonish me if a banking company is hiring a fairly unexperienced developer to maintain their system.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Does it have to be part of the web application? I've always implemented stuff like this in stand-alone daemon applications.



ilias basha wrote:Yes,

Actually i am working in a banking project where i need a thread to run in background that will take care of deducting balances of the customer when the actual scheduled date for payment is matching with the system date.



This doesn't tell us why the scheduled code needs to be part of your web application.

 
ilias basha
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:

ilias basha wrote:Thanks friend, i was also having similar thought but i am unable to implement it in code, so can you please help me in that regard.

Just start reading the API docs how/what to implement.
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContextListener.html
http://java.sun.com/javase/6/docs/api/java/util/TimerTask.html

By the way, is it a serious banking project or just some school project? Honestly, it would really astonish me if a banking company is hiring a fairly unexperienced developer to maintain their system.



Its an academic project friend, and i am really new to java environment.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ilias basha wrote:Its an academic project friend, and i am really new to java environment.


Ok. So the first step is - what do you have so far? Is there already an application that you are adding this to? Does it have a servlet yet?
 
ilias basha
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

ilias basha wrote:Its an academic project friend, and i am really new to java environment.


Ok. So the first step is - what do you have so far? Is there already an application that you are adding this to? Does it have a servlet yet?



No iam participating in a module where i need to deduct the balance of the respective customers who have scheduled their payments to a date as soon as the banking hours starts to that day.
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are into simple tasks then... you can use TimerTask but if you want full fledged API then you can use the Quartz.

 
ilias basha
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Srikanth Nutigattu wrote:If you are into simple tasks then... you can use TimerTask but if you want full fledged API then you can use the Quartz.



Thankzz
 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sun has introduced J2EE Timer Services , and if you are using weblogic , they have provided such a option , or else go for job schedulers like Quartz
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic