JTable 与 MySQL Cluster 实时更新
我读了几篇文档,它们告诉我,如果我想制作实时应用程序,我应该使用 MySQL Cluster。这就是我所做的。
但我无法找到如何在每次更新 MySql Cluster 中的值时更新 JTable。
您有任何链接或示例可以帮助解决我的问题吗?
提前致谢。
I read several doc that told me that if i want to make a realtime application, i should use MySQL Cluster
. So this is what i done.
But i wasn't able to find how to make a JTable
updated each time a value in the MySql Cluster
was updated.
Do you have any links or example that can help with my issue.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 java 应用程序是对数据库执行更新的应用程序还是其他进程可以进行更改?
如果只有您的应用程序进行更改,则每次发生更新/插入/删除操作时都可以触发一个事件来刷新表。
如果另一个进程可以对数据库进行更改,那么您将需要一个后台线程来偶尔查询数据库以获取更改。
就在 JTable 中显示数据而言,您可能需要一个非常定制的 TableModel 来缓存数据等。如果数据更改相当频繁,则可以最大程度地减少刷新的影响
Is your java app the one performing the updates on the database or is possible for other processes to make changes?
If only your app is making the changes, you can fire an event every time an update/insert/delete happens that will refresh the table.
If another process can make changes to the database then you'll need a background thread that will occasionally query the database for changes.
In terms of displaying the data in the JTable, you'll probably need a pretty customized TableModel to cache data, etc.. to minimize the effects of refreshing if the data is changing rather frequently