Cannot Connect From A Zos Machine To Oracle Installed On Windows

(Doc ID 1362378.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version: 11.2.0.1 and later   [Release: 11.2 and later ]
Information in this document applies to any platform.

Symptoms

On : 11.2.0.1 version, Thin JDBC driver

Having a simple JDBC program to test getting a connection generated the next error.
The problem happens using ojdbc6.jar from 11.2. The URL specifies the thin driver.

- When the program is run on Windows, it works fine.
- When the program is run on IBM zOS machine, it generated this error stack:
- When using 10.2.0.5 it works fine also.


ERROR
-----------------------
java.sql.SQLException: Internal - Unexpected value
at oracle.jdbc.driver.T4CTTIoauthenticate.processRPA(T4CTTIoauthenticate.java:516)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:295)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:390)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:356)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:317)
at java.sql.DriverManager.getConnection(DriverManager.java:353)
at TestOracle.getOracleConnectionFromCPDataSource(TestOracle.java:44)
at TestOracle.main(TestOracle.java:13)


STEPS
-----------------------
The issue can be reproduced at will with the following steps:


1) The java program I am using is just a standard test connection

import java.sql.Connection;
import java.sql.DatabaseMetaData;

public class TestOracle {

public static void main(String[] args) {

for (String arg : args) {
System.out.println(arg);
}

String serverName = args[0];
String databaseName = args[1];
String userName = args[2];
String password = args[3];
int port = new Integer(args[4]);

try {
Connection conn = getOracleConnectionFromCPDataSource(serverName,
databaseName, userName, password, port);
System.out.println("Connection is " + conn);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}

public static Connection getOracleConnectionFromCPDataSource(
String serverName, String databaseName, String userName,
String password, int port) throws Exception {
oracle.jdbc.pool.OracleConnectionPoolDataSource ds = new oracle.jdbc.pool.OracleConnectionPoolDataSource();

String urlValue = "jdbc:oracle:thin:" + userName + "/" + password + "@"
+ serverName + ":" + port + ":" + databaseName;
System.out
.println("Attempting to establish Oracle connection using URL DB**"
+ urlValue + "**");
ds.setURL(urlValue);
System.out.println("URL: " + ds.getURL());

Connection conn = ds.getConnection();
DatabaseMetaData metadata = conn.getMetaData();
System.out.println("Database is **"
+ metadata.getDatabaseProductVersion() + "** and driver is **"
+ metadata.getDriverVersion() + "**");

System.out.println("got CP Connection!");
return conn;
}
}

2) Oracle authentication

3) java -cp .:ojdbc6.jar TestOracle host servicename userid password port

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms