On January 27th, this site will be read-only as we migrate to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,560 Users
  • 2,269,760 Discussions
  • 7,916,781 Comments

Discussions

Getting IO Error: NL Exception was generated While connect DB through JAVA program

Hi All,

While connecting DB with SSL enabled connection through one sample java program we are getting below error but while do tnsping to new SSL enabled connection it works with out any issue. I had attached the sample java(DataSourceForJKS.txt) program which I used to test the connectivity.

Otherwise do anyone have any reference for sample JAVA code to test the SSL connection it will be helpful.

Exception in thread "main" java.sql.SQLRecoverableException: IO Error: NL Exception was generated

    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)

    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)

    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)

    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)

    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)

    at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:303)

    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:230)

    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:175)

    at DataSourceForJKS.main(DataSourceForJKS.java:71)

Thanks,

Debasis


Answers

  • Nirmala Sundarappa-Oracle
    Nirmala Sundarappa-Oracle Member Posts: 101 Employee
    edited Dec 3, 2022 6:18PM

    Your connection string is not formed correctly. You are using TNS_ADMIN, are you using tnsnames.ora? In that case, you need to mention only the TNS Alias and add the connection URL in that file. Connection URL should be of the following format.

    (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=<hostname>))(connect_data=(service_name=<service-name>))(security=(ssl_server_cert_dn="CN=<fill-in-with your-cert>, OU=Oracle, O=Oracle Corporation, L=Redwood City, ST=California, C=US"))