cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger in maxdb

Former Member
0 Kudos

Hai,

I had a requirement that, When the Database table is updated i need to invoke a java class. Is this possible with maxdb. please give me helpfull suggestions to achieve this requirement.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Hi Naga,

no, there's no way to have a trigger calling a java function out of MaxDB.

Anyhow, why does it have to be a java class? Usually triggers would be used to do things INSIDE the database.

Perhabs we can find an alternative solution for your problem, once you post it ...

KR Lars

Former Member
0 Kudos

Hai Lars,

The Actual problem , A Service is needed to watch the dabase table, suppose any data updated in the table, it will call some web services(Business logic). So I think any trigger can i write like this i can able to call web services using java class,.

regards,

TTK
Employee
Employee
0 Kudos

Hello Naga

Probably there is no other solution than to "simulate" a trigger. Did you consider something like following:

- a trigger, that writes a new line in an "event table"

- a Java routine polling this event table for new entries

Maybe the events must be associated with the updated row. In this case, you have to introduce another column with something like an event id from the event table, that is e.g. default serial (unique sequence of numbers).

Of course, polling is not elegant and eats more bandwidth/performance than events or triggers.

HTH Thomas

Former Member
0 Kudos

Hi Thomas,

- a trigger, that writes a new line in an "event table"

- a Java routine polling this event table for new entries

How can i implement polling concept in maxdb ,

please help me

TTK
Employee
Employee
0 Kudos

You wrote following as your application profile:

<i>The Actual problem , A Service is needed to watch the dabase table, suppose any data updated in the table, it will call some web services(Business logic). So I think any trigger can i write like this i can able to call web services using java class,.</i>

As far as I understood, I thought, that what you call Business logic runs outside the database. Therefore this outside running application polls the event table (i.e. select ... from <eventtable>) for new entries that are inserted by the trigger. If an entry is found and processed, it is deleted from the event table. Of course, there is a delay as polling is asnycronous to the trigger (e.g. every 30 seconds).

Does this solve your problem? Or do I still misunderstand you?

Regards Thomas

Former Member
0 Kudos

Hai Thomas,

I solved it by writing servlet. in that service method of the servlet , i wrote infineite loop that can read table continuosly at the period of 5 mins.

Its giving me correct out put .

But the servlet is became a killer of performance. can you guide me optimize the servlet or another way of solving the above problem

regards,

Naga raju

TTK
Employee
Employee
0 Kudos

> But the servlet is became a killer of performance.

> can you guide me optimize the servlet or another way

> of solving the above problem

Hm, do you use Thread.sleep()? Sleeping should not eat performance.

HTH Thomas

Former Member
0 Kudos

Hai Thomas,

I Sleep the Thread for 1200000 sec(2 min). But It is also a perfomance killer.

regards,

TTK
Employee
Employee
0 Kudos

> I Sleep the Thread for 1200000 sec(2 min). But It is

> also a perfomance killer.

Hm, either the tread is always waked up (InterruptedException) or some other thread consumes the performance. Did you try to count how often the sleeping is interrupted?

Or did you try the same stuff in a single test case. There you can make sure, that your polling etc. does work.

Regards Thomas

Former Member
0 Kudos

Hai Thomas ,

Thanks for your help .

I solved it .

Regards

Naga Raju

Answers (1)

Answers (1)

Former Member
0 Kudos

Hai,

please help me to solve this,

regards,