【问题标题】:Java Connection String to Oracle Cloud Database到 Oracle 云数据库的 Java 连接字符串
【发布时间】:2016-01-08 10:59:04
【问题描述】:

从 java 代码连接到 Oracle 云数据库时遇到问题。

  • 连接其他非云oracle数据库没问题。

  • 我可以使用 sql 工具连接到 Oracle 云数据库,Java 代码除外。

  • 主机名、用户名和密码是正确的,我不透露真实的用户名和密码。

错误: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

我的代码如下:

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();
}

【问题讨论】:

  • “ORA-12650:没有通用的加密或数据完整性算法”psoug.org/oraerror/ORA-12650.htm
  • 是的,我会用这条消息重新编辑帖子
  • 试试这个post from Oracle community,这可能会有所帮助。看来你必须为你正在使用的 JDBC 瘦客户端适当地设置你的 SQLNET.ORA

标签: java database oracle oracle-cloud-infrastructure-classic


【解决方案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;
}

【讨论】:

    【解决方案2】:

    似乎将连接字符串中的语法更改为查找 SERVICE_NAME 而不是 SID 必须帮助您连接数据库。

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

    补充阅读:Thin-style Service Name Syntax

    如果这也没有帮助,那么建议在数据库中的 sqlnet.ora 中添加以下 2 行。

    SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT= (SHA1)
    SQLNET.CRYPTO_CHECKSUM_CLIENT = requested
    

    【讨论】:

      【解决方案3】:

      第一个强制检查是验证 oracle jdbc 版本。如果你使用不兼容的版本,我们会得到这个孩子的错误。

      【讨论】:

        猜你喜欢
        • 2013-10-02
        • 1970-01-01
        • 1970-01-01
        • 2016-03-18
        • 1970-01-01
        • 1970-01-01
        • 2011-12-27
        • 1970-01-01
        • 2019-05-12
        相关资源
        最近更新 更多