解决Java连接Oracle 12c存在的问题

感谢作者

原文链接:https://blog.csdn.net/peng_wei_kang/article/details/80403486

1.发现项目报以下错误:

  1.  
    Caused by: java.sql.SQLException: ORA-28040: 没有匹配的验证协议
  2.  
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
  3.  
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:388)
  4.  
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:381)
  5.  
    at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:427)
  6.  
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
  7.  
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
  8.  
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:390)
  9.  
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:356)
  10.  
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
  11.  
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
  12.  
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
  13.  
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)

 

解决方法:

在oracle安装目录下的product12.2.0dbhome_1 etworkadminsqlnet.ora文件中新增一行,内容如下:

SQLNET.ALLOWED_LOGON_VERSION=8

SQLNET.ALLOWED_LOGON_VERSION=8

接着重启项目。

2.遇到以下错误:

  1.  
    Caused by: java.sql.SQLException: ORA-01017: 用户名/口令无效; 登录被拒绝
  2.  
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
  3.  
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:388)
  4.  
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:381)
  5.  
    at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:564)
  6.  
    at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431)
  7.  
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
  8.  
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
  9.  
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
  10.  
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
  11.  
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359)
  12.  
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
  13.  
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)

我确定账号密码没有错误,用sqlplus以及sql developer都可以连接,但通过项目连接就存在这个问题。

解决问题:

通过管理员账号重新去修改一下当前账号的密码为原来的密码

  1.  
  2. SQL< conn system/root;  (注意:此处是使用自己的管理员账号和密码去连接)
  3. SQL< alter user c##ansibee identified by ansibee;
  4.  
原文地址:https://www.cnblogs.com/ansibee/p/9656638.html