0
votes

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);
2
Drivers pretty commonly run small data dictionary queries-- is this query causing you a problem? This is likely the sort of implementation detail that no one is going to be able to answer without looking at the driver's code.Justin Cave
No problem as such, just that I need to be confirmed that this is Driver and reason for it if there are supportive documentation/source code reference for the same. Thanks.Sanjay
You could run the JDBC driver through a decompiler and try to find the query. Realistically, no driver is going to document every query that a driver might execute particularly when those queries can and do change between versions. What is the DBA's concern with this query?Justin Cave
DBA wanted to know the origin of it and in what instances it gets executed.Sanjay
Why does the DBA want to know? Databases have thousands of queries. No DBA has time to look at every query let alone chase down where the query is coming from and what causes it to be executed. It would only make sense to do so if the query was causing some sort of issue or appearing on some sort of "Top N" report. Hence the original question-- is this query causing some sort of problem?Justin Cave

2 Answers

1
votes

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.

0
votes

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