当前位置:网站首页>oracle连接池长时间不使用连接失效问题
oracle连接池长时间不使用连接失效问题
2022-07-06 19:26:00 【傲娇的喵酱】
背景:
我用python Oracle.SessionPool() 封装了连接池。启动项目后,一段时间内可以使用,
过几个小时不使用,再触发,连接池的连接就失效了。
原因:
我碰到的实际例子如下:
Web服务器与数据库之间有一个安全防火墙,这个防火墙会定期检查连接,如果某个连接长时间(30分钟)没有数据流过,就会被关闭。这种关闭使得检测连接还是打开的,却不能执行sql语句。但是如果连接一直有数据流动,就不会被关闭。
设置定期检测后,比较好解决了这个问题。
Oracle的实现上有这样一个设置,即给一个测试语句来测试数据库连接。一般都用 select 1 from dual 。 另外还有一个设置就是多长时间检测一次。一般设置15分钟。
也就是说Oracle的实现的方法,会自动定期用这个语句去检测数据库的连接,一旦检测到连接失败,就关闭连接并重新建立连接。
因此我建议楼主可以考虑这样的机制。毕竟网络连接是完全有可能断开的。
具体的解决方案,还是要自己探索的,我也没搞定。
原文地址:
边栏推荐
- 实施MES管理系统时,哪些管理点是需要注意的
- Planning and design of double click hot standby layer 2 network based on ENSP firewall
- Utilisation de la promesse dans es6
- Redis入门完整教程:问题定位与优化
- PSINS中19维组合导航模块sinsgps详解(时间同步部分)
- Cloud Mail . NET Edition
- 如何设计好接口测试用例?教你几个小技巧,轻松稿定
- c语言(字符串)如何把字符串中某个指定的字符删除?
- fasterxml ToStringSerializerBase报错
- Introduction to ins/gps integrated navigation type
猜你喜欢

Fundamentals of process management

Redis入门完整教程:复制拓扑

Cloud Mail .NET Edition

Classify the features of pictures with full connection +softmax

Babbitt | metauniverse daily must read: is IP authorization the way to break the circle of NFT? What are the difficulties? How should holder choose the cooperation platform

6-6漏洞利用-SSH安全防御

AWS learning notes (I)

Qt蓝牙:QBluetoothDeviceInfo

Redis入门完整教程:复制原理

记一次JAP查询导致OOM的问题分析
随机推荐
The panel floating with the mouse in unity can adapt to the size of text content
[2022 national tournament simulation] polygon - computational geometry, binary answer, multiplication
Redis入门完整教程:复制配置
MetaForce原力元宇宙佛萨奇2.0智能合约系统开发(源码部署)
MySQL --- 常用函数 - 字符串函数
INS/GPS组合导航类型简介
wzoi 1~200
What are the characteristics of the operation and maintenance management system
左程云 递归+动态规划
Difference and the difference between array and array structure and linked list
Remember the problem analysis of oom caused by a Jap query
Contribution of Writing Series
Convert widerperson dataset to Yolo format
Derivative, partial derivative, directional derivative
MES管理系统的应用和好处有哪些
Static proxy of proxy mode
测试优惠券要怎么写测试用例?
Cloud Mail . NET Edition
Fundamentals of process management
Unity webgl adaptive web page size