old jdbc driver generates ORA-28040

I read on note 401934.1 that Oracle 10gR2 jdbc clients are still supported with Oracle 12c.

I have an application using an oracle10gr2 jdbc, and connection to 12c generates ORA-28040.

Connection to 11gR2 works like a charm.

O12.java

import java.util.Properties;
import java.sql.*;

public class O12 {
public static void main(String argv[]) throws
SQLException {
Properties props = new Properties();
props.setProperty("user", "scott");
props.setProperty("password", "tiger");
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
argv[0], props);
System.out.println("JDBC Version: "+
conn.getMetaData().getDriverVersion());
conn.close();
}
}

compile

javac -cp ojdbc14.jar O12.java

test with jdbc 10.2.0.2 db 11.2.0.4

java -cp ojdbc14.jar:. O12 jdbc:oracle:thin:@DB11204:1521:DB11204
JDBC Version: 10.2.0.2.0

test with jdbc 10.2.0.2 db 12.1.0.2

java -cp ojdbc14.jar:. O12 jdbc:oracle:thin:@DB12102:1521:DB12102
Exception in thread "main" java.sql.SQLException: ORA-28040: No matching authentication protocol

The easy solution of course is to update the driver. Even without recompile it worked.

test with jdbc 11.2.0.1 db 12.1.0.2

java -cp ojdbc5.jar:. O12 jdbc:oracle:thin:@DB12102:1521:DB12102
JDBC Version: 11.2.0.1.0

Before upgrading the db server to 12c, check 10g jdbc jar’s are upgraded

3 Comments

  • It still will work, if SQLNET.ALLOWED_LOGON_VERSION is set to old value (i.e. 10).
    Of course, it’s better to update the jdbc driver anyway.

  • Thanks Lucas. It is a good hint, with a 11gR2 listener, I could even connect with jdbc 9i to a 12c database.


    java -cp .:classes12.jar O12 jdbc:oracle:thin:@DB12102:1521:DB12102
    JDBC Version: 9.2.0.1.0

    However, with a 12cR1 listener and SQLNET.ALLOWED_LOGON_VERSION_SERVER=10 and jdbc 10.2.0.2, I still get the same ORA-28040

  • I found on Metalink, you can also do


    java -cp .:classes12.jar O12 "{oracle.jdbc.V8Compatible=true}jdbc:oracle:thin:@DB12102:1521:DB12102"
    JDBC Version: 9.2.0.1.0

    This works with a 12c listener

Leave a Reply