aspose file tools*
The moose likes Servlets and the fly likes code that runs automatically to update sql tables on a specified date and time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "code that runs automatically to update sql tables on a specified date and time" Watch "code that runs automatically to update sql tables on a specified date and time" New topic
Author

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

ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

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

Joined: Oct 08, 2006
Posts: 2458
Implement ServletContextListener and extend TimerTask.
ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

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

Joined: Jan 10, 2002
Posts: 60071
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

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

Joined: Oct 08, 2006
Posts: 2458
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

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?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

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

Joined: Oct 30, 2007
Posts: 114
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

Joined: Nov 27, 2008
Posts: 55

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

Joined: Jan 30, 2009
Posts: 528
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


If you want something you never had do something which you had never done
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code that runs automatically to update sql tables on a specified date and time
 
Similar Threads
JDBC-hibernate
AS400 Column Mapping Resultset DATE TIME
JDBC template outer join and cast(@myValue AS date)
How to Create Auto Schema
Handling Date in Hibernate