开发者

Ways to Actively Update Java from MySQL

What is the best way to update a Java or GWT program from MySQL. For example, a MySQL database which holds Weather information... updating whenever the weather changes a degree. How would I update a Java / GWT field with each update. Would I use a thread to query every 开发者_StackOverflow社区few seconds??


Certainly you can do polling.

Alternately, you could use a trigger to trigger a stored procedure that then sends a message to your running Java program. This would probably require that you write a C++ function to install in your MySQL installation as a custom procedure. Apparently (and this is cool) it's possible to do that on-the-fly without even stopping the server, via the plug-in API.

Edit A third option that really should have been at the top of my original answer: If there's any way to channel the updates to the DB through the business logic layer (!), that would probably be the best way to go. If the update absolutely has to come from somewhere other than your Java program, pehaps it could notify your Java program in addition to updating the database?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜