1

I had problem when connecting to Oracle Cloud Database from java code.

  • I have no problem connecting other non-cloud oracle databases.

  • I can connect to the Oracle Cloud Database with sql tools, except from the java codes.

  • The hostname, username and password is correct one, i don't reveal the real username and password.

Error: java.sql.SQLException:

SQLException: SQLState(null) vendor code(17002)
java.sql.SQLException: Io exception: Oracle Error ORA-12650: No common encryption or data integrity algorithm

My code as following:

String dbURL = "jdbc:oracle:thin:@192.133.133.23:1521:ORCL";

try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection(dbURL, "username1", "password");


}catch(Exception)
{
  e.printStacktrace();
}
char
  • 2,063
  • 3
  • 15
  • 26
hades
  • 4,294
  • 9
  • 46
  • 71
  • "ORA-12650: No common encryption or data integrity algorithm" http://psoug.org/oraerror/ORA-12650.htm – awsome Jan 08 '16 at 11:05
  • yup, i will re-edit the post with this message – hades Jan 08 '16 at 11:05
  • Try this [post from Oracle community](https://community.oracle.com/thread/1325615?start=0&tstart=0) which might help.. It seems you have to setup your SQLNET.ORA appropriately for JDBC thin client which it seems is what you are using – vmachan Jan 08 '16 at 11:10

3 Answers3

1
/**
 * The below one is for oracle thin client
   Its worked for the ojdbc6 driver. 
 */
public Connection conCheck() {

      Connection con=null;
      try { //step1 load the driver class
      Class.forName("oracle.jdbc.OracleDriver");

      Properties props = new Properties();
      props.put("oracle.net.encryption_client", "REQUIRED");
      props.put("oracle.net.encryption_types_client",  "( " + AnoServices.ENCRYPTION_AES256 + "," +AnoServices.ENCRYPTION_AES192 + ")");
      props.put("oracle.net.crypto_checksum_types_client", "( SHA1 )");
      props.put("user", "username");
      props.put("password","password");

    //step2 create  the connection object          
      con=DriverManager.getConnection(  "jdbc:oracle:thin:@host:port:serveiceid",props);

       System.out.println("Con"+con);
      }catch(Exception e) {e.printStackTrace(); }       

 return con;
}
lczapski
  • 4,026
  • 3
  • 16
  • 32
Bibin Raj
  • 69
  • 2
  • 8
0

Seems like changing syntax in your connection string to lookup SERVICE_NAME instead of SID must help you connect your database.

String dbURL = "jdbc:oracle:thin:@192.133.133.23:1521/ORCL";

Additional Read : Thin-style Service Name Syntax

If this as well doesn't help, then would suggest to add below 2 lines to your sqlnet.ora in database.

SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT= (SHA1)
SQLNET.CRYPTO_CHECKSUM_CLIENT = requested
Saiprasad Bane
  • 477
  • 4
  • 9
0

First mandatory check is to verify the oracle jdbc version. if you use incompatible version,we will get this kid of errors.

Bibin Raj
  • 69
  • 2
  • 8