开发者

background process using thread

I want to continuously check a table in the database to see whether a new row ha开发者_StackOverflow社区s been added to it. This runs as a back ground process. I think a thread should be used for this task. but I have no idea how to write the code. Can somebody help me with this please?


Well, you're not really giving us much to go on here.

You might find it easier to use a database trigger, which will fire some code whenever a specified action occurs (e.g. insertion of new data). You will need to look up details for your specific database.

I just realised that you have probably already tried to use triggers and failed: sql trigger not work as expected. Either approach will work, but I would prefer keeping everything in the DB and avoiding external processes if possible.

What should happen if an insert occurs but your process has died for some reason?


Oracle can now communicate to Java via listener. So if you register for some event, your Java listener will receive that event from the database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜