113

I am trying to connect my grails project to Oracle databse(Oracle 12c) in windows(8) system. However, whenever I run my application I get following exception :

Caused by: org.apache.commons.dbcp.SQLNestedException: 
Cannot create PoolableConnectionFactory (ORA-28040: 
No matching authentication protocol)

Caused by: 
java.sql.SQLException: ORA-28040: 
No matching authentication protocol

According to internet suggestion I also tried editing my *.ora file but it is not working.

I added following snippet in sqlnet.ora file :

SQLNET.ALLOWED_LOGON_VERSION=10
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=10
SQLNET.ALLOWED_LOGON_VERSION_SERVER=10

Here i tried assigning (10,11,12) but neither of them is working.

Can anyone please help me with this ?

Nicolás Alarcón Rapela
  • 2,714
  • 1
  • 18
  • 29
Aman Adhikari
  • 3,240
  • 3
  • 22
  • 32

12 Answers12

171

I deleted the ojdbc14.jar file and used ojdbc6.jar instead and it worked for me

doelleri
  • 19,232
  • 5
  • 61
  • 65
Aman Adhikari
  • 3,240
  • 3
  • 22
  • 32
  • 3
    experience same issue while trying to connect Oracle 12c from pentaho kettle. removed ojdbc14.jar and its perfectly working! – lourdh May 22 '15 at 08:48
  • Same error when Connecting Cognos 10.2.1 fp7 to Oracle 12c content store database. Removed ojdbc14.jar from '[10 bi install folder]\webapps\p2pd\WEB-INF\lib' and added ojdbc6.jar, works great. – Damienknight Jul 07 '15 at 14:47
  • In my case i need swap ojdbc14.jar for ojdbc7.jar in my tomcat lib on: `Apache\tomcat-7.0.27\lib' – Fernando Nogueira Feb 22 '16 at 18:25
  • 20
    At least a brief explanation **why** this should work would be quite handy. – Yuriy Kravets May 10 '16 at 09:10
  • 8
    For me, changing to ojdbc6.jar or ojdbc7.jar still failed because I had been constantly setting: `oracle.jdbc.thinLogonCapability"="o3"` which you no longer have to do against oracle 12c. Hope it can help someone else – James Tobin Aug 22 '16 at 19:24
  • Worked for me as well. Wish eclipse made errors and exceptions clearer. Oh well. – SoftwareSavant Jan 13 '17 at 17:39
  • @JamesTobin Thanks a ton, that fixed the issue for me. It might be worth posting that as a separate answer so it's easier to find. – nbrooks Mar 12 '17 at 13:55
  • 3
    That works perfect after deleting ojdbc14.jar and using the ojdbc6.jar – Sam Nov 09 '17 at 16:49
  • make sure it is in lib folder not ext folder. – RMati Oct 30 '18 at 23:24
  • I have replaced OJDBC14.jar by OJDBC6.jar and now the program build on ORACLE 10 server work on Developement PC with Oracle 12C without building original Java program. – schlebe Feb 06 '19 at 11:04
  • 4
    @YuriyKravets The number **14** in **ojdbc14.jar** and number **6** in **ojdbc6.jar** refers to the JDK version they were written for. If you open the **ojdbc14.jar's** manifest file, it says: _Specification-Title: "Oracle JDBC driver classes for use with JDK1.4"_ Similarly, ojdbc6.jar supports JDK1.6 implementation. – Maverick Jun 25 '19 at 10:01
  • @Maverick well... that's one of the most unfortunate versioning convention I've seen to far. – Yuriy Kravets Jun 25 '19 at 11:54
  • @YuriyKravets you should go to your oracle_home directory ... you will find a directory named "jdbc" ... in this folder you will find the proper jar files for jdbc use... this is why you should change the version of jar file in question answer... hope this help someone – Zeinab Ghaffarnasab Oct 03 '19 at 22:33
  • I also faced same issue. but I resolved based on jdk and its version. So it depends on which Jdk version is used. if you are using Jdk 1.6 then ojdbc6.jar is required to be used. if you are using a higher version of Jdk then you can latest version of ojdbcX. jar – Ramgau Jan 28 '20 at 11:06
  • Also if you are working on intellij, please restart after making changes and also check "external libraries" on the left shows the right oracle driver – Amandeep Dec 30 '20 at 17:06
  • 1
    In my case I was connecting to Oracle 19c. oracle8.jar worked for me. – Nilucshan Siva Jun 25 '21 at 07:22
  • @NilucshanSiva That's wrong. I'm using oracle8.jar and Oracle 19c and still get this error. – Philip Rego Apr 26 '22 at 19:55
60

Here is some text I found at experts-exchange:

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.

zb226
  • 9,586
  • 6
  • 49
  • 79
Simon
  • 609
  • 5
  • 3
  • Just for reference: This worked for me not deleting the ojdbc14.jar file and using ojdbc6.jar – rageit Sep 30 '16 at 16:53
  • 4
    yes, in my case this solved the issue, but another occured : invalid username/password. btw i was trying to connect from oracle jdeveloper 10 to oracle database 12c. so this gave be the answer : https://stackoverflow.com/questions/14476875/ora-01017-invalid-username-password-when-connecting-to-11g-database-from-9i-clie#14477188 finally had to: 1) change SQLNET.ALLOWED_LOGON_VERSION to 8 2) SQLNET.AUTHENTICATION_SERVICES to (NONE) 3) ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = FALSE 4) ALTER USER XX IDENTIFIED BY PW (to resave the password now that we changed case-sensitivity) – hello_earth May 29 '17 at 07:44
  • Late to the party, but I've also confirmed this fix. I _had_ to set my version = 8 even though I was running JDBC 11 -- nothing newer than 8 worked. – Keith Jan 18 '18 at 15:31
  • I am using a remote database server, i do not have access to machine, I can just connect to database using SQL Developer (Without error), but my application (deployed on Tomcat ) throws this error. I have changed the settings at my local machine, it is not working. Do i have to modify the settings on server machine? – Gunwant Nov 13 '19 at 14:29
  • I don't have access to `oracle/network/admin/sqlnet.ora` nor do you say where this file is – Philip Rego Apr 26 '22 at 19:59
13

This except for adding the following to sqlnet.ora

SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

If you get "ORA-01017: invalid username/password; logon denied" error, then you need to re-create your password.

CodeArt
  • 858
  • 8
  • 10
8

I resolved this issue by using ojdbc8.jar. Oracle 12c is compatible with ojdbc8.jar

Shardendu
  • 3,480
  • 5
  • 20
  • 28
5

I was using eclipse and after trying all the other answers it didn't work for me. In the end, what worked for me was moving the ojdb7.jar to top in the Build Path. This occurs when multiple jars have conflicting same classes.

  1. Select project in Project Explorer
  2. Right click on Project -> Build Path -> Configure Build Path
  3. Go to Order and Export tab and select ojdbc.jar
  4. Click button TOP to move it to top
Sandesh Gupta
  • 1,175
  • 2
  • 11
  • 19
4

Very old question but providing some additional information which may help someone else. I also encountered same error and I was using ojdbc14.jar with 12.1.0.2 Oracle Database. On Oracle official web page this information is listed that which version supports which database drivers. Here is the link and it appears that with Oracle 12c and Java 7 or 8 the correct version is ojdbc7.jar.

In the ojdbc6.jar is for 11.2.0.4.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Karan
  • 752
  • 2
  • 13
  • 34
3

Except for adding the following to sqlnet.ora

SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

I also added the following to both the Client and Server, which resolved my issue

SQLNET.AUTHENTICATION_SERVICES = (NONE)

Also see post ORA-28040: No matching authentication protocol

Community
  • 1
  • 1
1

Adding

SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

is the perfect solution sql.ora directory ..\product\12.1.0\dbhome_1\NETWORK\ADMIN

Birhan Nega
  • 663
  • 12
  • 24
0

My Initial error is : ORA-28040: No matching authentication protocol exception

My DB version is 12.2 (Solaris) and client version is 11.2 ( windows). I have added below in both server and client sqlnet.ora

SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8 SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

while connecting, I have got invalid username and password hence I have recreated the password ( same password ) in database which is resolved my issue.

0

While for most cases replacing ojdbc driver jar will be the solution, my case was different.

If you are certain you are using correct ojdbc driver. Double check if you are actually connecting to the database you are thinking you are. In my case jdbc configuration (in Tomcat/conf) was pointing to different database that had different Oracle version.

user435421
  • 859
  • 2
  • 13
  • 31
0

Using ojdbc8.jar helped me with birt connection issue:

org.eclipse.birt.report.data.oda.jdbc.JDBCException: There is an error in get connection, ORA-28040: No matching authentication protocol

I downloaded it from https://download.oracle.com/otn-pub/otn_software/jdbc/1918/ojdbc8.jar

-1

just install ojdbc-full, That contains the 12.1.0.1 release.