3

Initially we were using Oracle 11g database. Now we wanted to upgrade to 12c database, while in testing phase of this migration, we are facing issue in connecting to database using hibernate as we are getting "No matching authentication protocol" error.

I tried in all forums everyone suggested to upgrade ojdbc14 jar to ojdbc6 jar.

But we are not using ojdbc14 jar in my project.

We are using mostly com.springsource jars.

Kranthi Sama
  • 498
  • 3
  • 10
  • 28

2 Answers2

1

I think you saw that workaround which says that SQLNET.ALLOWED_LOGON_VERSION should be set to 8 which means allowing legacy clients to connect. I don't think that this is good idea. You should update your drivers you can get it here.

To find jar library try to search for class oracle.jdbc.driver.OracleDriverin your IDE.

Only if you aren't able to upgrade your solution to java 7 or 8 try to do that workaround.

Workaround - to create a sqlnet.ora in the /network/admin location with the following parameter:

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8

Oracle documentation

Let’s clarify a little bit Spring is light weight alternative to J2EE. Spring aim is to help structure whole application in the better way make it more consistent by pulling together best-of-breed single–tier frameworks to create a coherent architecture.

You plugged to your app Hibernate this is ORM (Object-Relational Mapping) framework for mapping an object-orientated domain model to a relational database.

Hibernate initializes JDBC (Java DataBase Connectivity this is API for java which defines how a client may access database) connection which could be configured:

  1. Standalone configuration you will use driver configured inside your app.
  2. Datasource connection over JNDI then all db drivers and configurations are on app server side Hibernate user JNDI name to connect.

Please can you share what kind of configuration you use if you not sure please add you Hibernate configuration?

Saulius Next
  • 1,340
  • 10
  • 16
  • Our application currently uses Java 8 and my application is not using OracleDriver directly, because my application is using Hibernate. I am unable to find the exact hibernate jar file to upgrade. – Kranthi Sama Mar 21 '17 at 07:34
  • Even if you use hibernate you need jdbc driver. Chek your dependcies. What build tool do you use mave or gradle? – Saulius Next Mar 21 '17 at 07:46
  • We are using Jar files. We are not sure what version of Hibernate willl support Oracle 12c. Currently our hibernate version is 3.3.0.SP1 – Kranthi Sama Mar 21 '17 at 08:03
  • We are mostly using com.springsource...... type of jar files, but i am unable to get the latest jars from Maven. when i try to download the latest jar it is showing error. For example com.springsource.org.hibernate.jar – Kranthi Sama Mar 21 '17 at 08:20
0

For maven users

If your project using maven, then you need to change in pom.xml

Use the ojdbc6.jar/ojdbc7.jar instead of ojdbc14.jar

Use one of the following jars in your pom.xml as dependency.

<!-- ojdbc6.jar example -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0</version>
</dependency>

OR,

<!-- ojdbc7.jar example -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc7</artifactId>
    <version>12.1.0.2</version>
</dependency>

Remove the following dependency from your pom.xml

<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.2.0</version>
</dependency>

For gradle users

Use the dependency in your build.gradle

// https://mvnrepository.com/artifact/oracle/ojdbc6
compile group: 'oracle', name: 'ojdbc6', version: '11.2.0.3'

or

// https://mvnrepository.com/artifact/cn.easyproject/ojdbc7
compile group: 'cn.easyproject', name: 'ojdbc7', version: '12.1.0.2.0'

Remove the dependency from your build.gradle

// https://mvnrepository.com/artifact/com.oracle/ojdbc14
compile group: 'com.oracle', name: 'ojdbc14', version: '10.2.0.2.0'

Resource Link:

https://blogs.oracle.com/dev2dev/entry/oracle_maven_repository_instructions_for

Add the following in oracle/network/admin/sqlnet.ora file :

SQLNET.ALLOWED_LOGON_VERSION=8
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8

Why you will use 8?

Bug 14575666

In 12.1, the default value for the SQLNET.ALLOWED_LOGON_VERSION parameter has been updated to 11. This means that database clients using pre-11g JDBC thin drivers cannot authenticate to 12.1 database servers unless theSQLNET.ALLOWED_LOGON_VERSION parameter is set to the old default of 8.

This will cause a 10.2.0.5 Oracle RAC database creation using DBCA to fail with the ORA-28040: No matching authentication protocol error in 12.1 Oracle ASM and Oracle Grid Infrastructure environments.

Workaround: Set SQLNET.ALLOWED_LOGON_VERSION=8 in the oracle/network/admin/sqlnet.ora file.

Resource Link:

  1. ORA-28040: No matching authentication protocol exception
  2. https://stackoverflow.com/a/26629916/2293534

If 8 does not work then,

Prior to version 12c the default setting for SQLNET.ALLOWED_LOGON_VERSION (the equivalent parameter prior to 12c) was 8 .

In 12c the default is now 11.

Resource Link:

http://www.redstk.com/ora-28040-no-matching-authentication-protocol-after-upgrade-to-12c/

Community
  • 1
  • 1
SkyWalker
  • 28,384
  • 14
  • 74
  • 132