当前位置:网站首页>oracle连接池长时间不使用连接失效问题
oracle连接池长时间不使用连接失效问题
2022-07-06 19:26:00 【傲娇的喵酱】
背景:
我用python Oracle.SessionPool() 封装了连接池。启动项目后,一段时间内可以使用,
过几个小时不使用,再触发,连接池的连接就失效了。
原因:
我碰到的实际例子如下:
Web服务器与数据库之间有一个安全防火墙,这个防火墙会定期检查连接,如果某个连接长时间(30分钟)没有数据流过,就会被关闭。这种关闭使得检测连接还是打开的,却不能执行sql语句。但是如果连接一直有数据流动,就不会被关闭。
设置定期检测后,比较好解决了这个问题。
Oracle的实现上有这样一个设置,即给一个测试语句来测试数据库连接。一般都用 select 1 from dual 。 另外还有一个设置就是多长时间检测一次。一般设置15分钟。
也就是说Oracle的实现的方法,会自动定期用这个语句去检测数据库的连接,一旦检测到连接失败,就关闭连接并重新建立连接。
因此我建议楼主可以考虑这样的机制。毕竟网络连接是完全有可能断开的。
具体的解决方案,还是要自己探索的,我也没搞定。
原文地址:
边栏推荐
- Kubernetes源码分析(二)----资源Resource
- Metaforce force meta universe fossage 2.0 smart contract system development (source code deployment)
- 密码学系列之:在线证书状态协议OCSP详解
- [leetcode]Search for a Range
- LeetCode 77:组合
- MetaForce原力元宇宙佛萨奇2.0智能合约系统开发(源码部署)
- Redis Getting started tutoriel complet: positionnement et optimisation des problèmes
- 代码调试core-踩内存
- Leetcode 77: combination
- NuScenes数据集关于Radar数据的统计
猜你喜欢
Change your posture to do operation and maintenance! GOPs 2022 Shenzhen station highlights first!
【2022国赛模拟】多边形——计算几何、二分答案、倍增
Google Earth Engine(GEE)——Landsat 全球土地调查 1975年数据集
ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法
What are the characteristics of the operation and maintenance management system
Redis introduction complete tutorial: replication principle
S120驱动器基本调试步骤总结
Planning and design of double click hot standby layer 2 network based on ENSP firewall
MySQL提升大量数据查询效率的优化神器
巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...
随机推荐
如何设计好接口测试用例?教你几个小技巧,轻松稿定
写作系列之contribution
6-6漏洞利用-SSH安全防御
MySQL提升大量数据查询效率的优化神器
[leetcode]Search for a Range
NuScenes数据集关于Radar数据的统计
A complete tutorial for getting started with redis: problem location and optimization
Oracle中日期的使用方法实例
Fundamentals of process management
惯导标定国内外研究现状小结(删减版)
wzoi 1~200
MetaForce原力元宇宙佛萨奇2.0智能合约系统开发(源码部署)
Matlb| economic scheduling with energy storage, opportunity constraints and robust optimization
Summary of research status of inertial navigation calibration at home and abroad (abridged version)
fasterxml ToStringSerializerBase报错
The so-called consumer Internet only matches and connects industry information, and does not change the industry itself
Static proxy of proxy mode
What are the characteristics of the operation and maintenance management system
Kysl Haikang camera 8247 H9 ISAPI test
你不可不知道的Selenium 8种元素定位方法,简单且实用