You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ashish Kulkarni <as...@gmail.com> on 2007/06/01 21:29:32 UTC

checking for Database changes

Hi
I have a requirement where i have to constantly monitor a database for
changes, for example if thers is an row added, or row changed the java
program will process those records.
is there any good way of doing it, currently i am thinking of writing a
TimerTask which will sleep for 5-10 seconds to read the database.
I have a flag in database which is updated when it is processed, so i need
to monitor for all the rows where this flag is not updated.

any ideas?

Ashish

Re: checking for Database changes

Posted by Na...@healthnet.com.
Make the trigger put new records in a temp table as well as in the original
table.  Remove records from the temp table as you successfully process the
records. In case of error keep the record in the temp table until record is
successfully processed.






                                                                           
             "Ashish Kulkarni"                                             
             <ashish.kulkarni1                                             
             3@gmail.com>                                               To 
                                       user-java@ibatis.apache.org         
             06/04/2007 07:02                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: checking for Database changes   
             Please respond to                                             
             user-java@ibatis.                                             
                apache.org                                                 
                                                                           
                                                                           
                                                                           




Hi
The problem is, i can put a trigger on database, but what happens is if the
java process fails, there is no way to resubmit this process, so those
records will be in database for ever,
so the work around is to have java process monitor database and process
records as soon as they enter the database.

any suggestions on the issue

On 6/4/07, Nathan Maves <na...@gmail.com> wrote:
  Hmmm...

  My first thought is to let the database do this for you.  I would use a
  trigger on the tables that you are watching.  At that point you can
  trigger events as they come in.  With out a little more background on the
  problem statement I am not sure how much help we can give.

  Nathan


  On 6/1/07, Ashish Kulkarni < ashish.kulkarni13@gmail.com> wrote:
   Hi
   I have a requirement where i have to constantly monitor a database for
   changes, for example if thers is an row added, or row changed the java
   program will process those records.
   is there any good way of doing it, currently i am thinking of writing a
   TimerTask which will sleep for 5-10 seconds to read the database.
   I have a flag in database which is updated when it is processed, so i
   need to monitor for all the rows where this flag is not updated.

   any ideas?

   Ashish





---------------------------------------------------------------------
This message, together with any attachments, is
intended only for the use of the individual or entity
to which it is addressed. It may contain information
that is confidential and prohibited from disclosure.
If you are not the intended recipient, you are hereby
notified that any dissemination or copying of this
message or any attachment is strictly prohibited. If
you have received this message in error, please notify
the original sender immediately by telephone or by
return e-mail and delete this message, along with any
attachments, from your computer. Thank you.

---------------------------------------------------------------------

Re: checking for Database changes

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
The problem is, i can put a trigger on database, but what happens is if the
java process fails, there is no way to resubmit this process, so those
records will be in database for ever,
so the work around is to have java process monitor database and process
records as soon as they enter the database.

any suggestions on the issue

On 6/4/07, Nathan Maves <na...@gmail.com> wrote:
>
> Hmmm...
>
> My first thought is to let the database do this for you.  I would use a
> trigger on the tables that you are watching.  At that point you can trigger
> events as they come in.  With out a little more background on the problem
> statement I am not sure how much help we can give.
>
> Nathan
>
> On 6/1/07, Ashish Kulkarni <as...@gmail.com> wrote:
> >
> > Hi
> > I have a requirement where i have to constantly monitor a database for
> > changes, for example if thers is an row added, or row changed the java
> > program will process those records.
> > is there any good way of doing it, currently i am thinking of writing a
> > TimerTask which will sleep for 5-10 seconds to read the database.
> > I have a flag in database which is updated when it is processed, so i
> > need to monitor for all the rows where this flag is not updated.
> >
> > any ideas?
> >
> > Ashish
> >
>
>

Re: checking for Database changes

Posted by Nathan Maves <na...@gmail.com>.
Hmmm...

My first thought is to let the database do this for you.  I would use a
trigger on the tables that you are watching.  At that point you can trigger
events as they come in.  With out a little more background on the problem
statement I am not sure how much help we can give.

Nathan

On 6/1/07, Ashish Kulkarni <as...@gmail.com> wrote:
>
> Hi
> I have a requirement where i have to constantly monitor a database for
> changes, for example if thers is an row added, or row changed the java
> program will process those records.
> is there any good way of doing it, currently i am thinking of writing a
> TimerTask which will sleep for 5-10 seconds to read the database.
> I have a flag in database which is updated when it is processed, so i need
> to monitor for all the rows where this flag is not updated.
>
> any ideas?
>
> Ashish
>