使用Oracle JDBC驱动程序时,发现多余的连接正在执行SELECT SYS_CONTEXT查询。

huangapple go评论66阅读模式
英文:

With Oracle JDBC driver seeing extra connection doing SELECT SYS_CONTEXT Query

问题

无法找到Oracle文档提及有关此查询从连接引起的原因。使用JDBC驱动程序ojdbc7-12.1.0.2.jar。

我们注意到有一个连接在短时间内运行了以下操作

SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL

在代码中

connection = provider.getConnection();
connection.setNetworkTimeout(Executors.newSingleThreadExecutor(), network_timeout);
英文:

Unable to find Oracle documents referring to the cause for this Query from Connection. Using the JDBC Driver ojdbc7-12.1.0.2.jar

We saw that there was one connection for brief time running
SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL

In Code

connection = provider.getConnection();
connection.setNetworkTimeout(Executors.newSingleThreadExecutor(), network_timeout);

答案1

得分: 1

以下是翻译好的内容:

Oracle JDBC驱动程序在连接池中定义了n个连接作为最大连接数时,将打开max(n+1)个连接。其中的1个是用于管理池中的管理会话。

英文:

The Oracle JDBC Driver opens max(n+1) connections if n connections are defined as maximum number of connections in connection pool. The 1 is a administrative session handling the pool.

答案2

得分: 0

甲骨文JDBC驱动程序在连接池中将最多打开max(n+1)个连接,如果n个连接被定义为连接池中的最大连接数。其中的1是处理池的管理会话。
这不仅是JDBC的行为,也出现在甲骨文.NET提供程序和OCI中——据我所记得。

英文:

The Oracle JDBC Driver opens max(n+1) connections if n connections are defined as maximum number of connections in connection pool. The 1 is a administrative session handling the pool.
This is not a JDBC only behaviour but seen in Oracle .NET provider and OCI, too - as far I can remember

huangapple
  • 本文由 发表于 2020年10月16日 23:07:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/64391787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定