My Oracle Support Banner

Is There A Way To Set The ORACLE_SID Inside Java For Making A Bequeath Connection With Oracle JDBC ? (Doc ID 2646549.1)

Last updated on MARCH 12, 2020

Applies to:

JDBC - Version 12.2.0.0.0 and later
Information in this document applies to any platform.

Symptoms

Is there a way to set the ORACLE_SID inside java for making a Bequeath Connection? If  ORACLE_SID environment variable is not set, the Bequeath Connection does not work, and the following exception is thrown:

java.sql.SQLException: ORA-12162: TNS:net service name is incorrectly specified

at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:1157)
at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:1060)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:727)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:793)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:62)

Various connection properties are tried via setConnectionProperties and some setters on the OracleDataSource, but the issue persists.

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.