Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
ilias basha
Ranch Hand
Posts: 55
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic