tomcat dbcp 和 mysql 连接池
我正在使用 tomcat dbcp 和 spring jdbc。当我第一次启动服务器并尝试加载网页时,它会从数据库中获取数据并返回正确的结果集,但是当我使用编辑器对数据库进行一些更改并尝试重新加载页面时,它会显示旧的结果集。我尝试了数据库日志记录,可以看到查询已到达数据库。我认为结果集被缓存在容器中的某个地方。有人可以告诉我我需要处理什么参数吗?
帮助将不胜感激。
谢谢。
I am using a tomcat dbcp along with spring jdbc. When I start the server for first time and try to load the web-page it fetches the data from database and returns correct result set but when i make some changes to db using editor and try to reload the page, it shows old result set. I tried database logging and can see that query is reached to database. I think the result set is being cached somewhere in the container..Can someone tell me what parameter i need to take care of.
help will be appreciated.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AngerClown,谢谢您的回复。你让我找到了问题的真正痛点。
真正的问题在于数据库方面。不知何故,由于一些主键索引问题,某些进程已获取表上的锁,同时我从查询浏览器的自动提交设置为 false。因此,当我尝试在同一事务中获取数据时,更改得到了反映,但没有反映在其他事务中。
我没有太费心,只是重新创建了表格。现在它运行良好。
多谢。
-桑托什。
AngerClown, thanks for your replies. You got me to the real pain point of the problem.
The real problem was lying on database side. Somehow because of some primary key indexing issues some process has acquired the lock on the table and at the same time my autocommit from query browser was set to false. Because of this when i tried to fetch the data in same transaction changes got reflected but not in other transaction.
Without bothering much about it, I just recreated the table. And now it is working fine.
Thanks a lot.
-Santosh.