Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check table contents ?!!

 
moh sak
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Phillip Koebbe
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic