File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Check table contents ?!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Check table contents ?!!" Watch "Check table contents ?!!" New topic

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: 1082

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

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

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

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:


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

I agree. Here's the link:
subject: Check table contents ?!!
It's not a secret anymore!