File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Check table contents ?!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Check table contents ?!!" Watch "Check table contents ?!!" New topic
Author

Check table contents ?!!

moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi every one,


i have a table in the database i want to check it every 5 min. to see if there is new data in it , how this can be done ??

plz help as soon as posible.


thanks in advance
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

hit the database at every 5 minutes !

you can use EJB Timer(in EJB 2.1), or in your program create a Thread which calls your method which hit database, or use some open source schedular.

It actually depend on your requirement that what you want to achieve

At database side you can use count of rows( but on deletion of rows you will suffer), you can use trigger on insert(I will prefer) so that you can track new records

Shailesh
[ June 26, 2005: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Phillip Koebbe
Greenhorn

Joined: Jun 22, 2005
Posts: 27
If you have an auto incrementing key in the table, you could also do something like:



and store that in a variable in your application. Then, when your timed event kicks off, you have some choices of what to do. You could either run the same query again and then test the returned MAX to what you have locally, or you could run a different query, such as:



or



You can do a few different things depending on the specific needs of your application.

Peace,
Phillip
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check table contents ?!!