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

首先安装好Oracle 12c,然后创建表空间->创建用户->导入数据库->启动项目。

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

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

解决问题:

在oracle安装目录下的/network/admin/sqlnet.ora文件新增一行,内容如下:

SQLNET.ALLOWED_LOGON_VERSION=8

接着重启项目。

2.遇到如下错误:

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

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

解决问题:

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

sqlplus system/root@ORCL;
alter user c##recognize identified by recognize;



发布了26 篇原创文章 · 获赞 39 · 访问量 11万+
展开阅读全文

java web连接Oracle12c 报 没有匹配的身份验证协议

08-28

之前连接本地11g的数据库没问题,连接12c报错信息如下: ERROR [com.njry.util.DBHelper:294]- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28040: No matching authentication protocol ) org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28040: No matching authentication protocol ) 1 2 ERROR [com.njry.util.DBHelper:294]- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28040: No matching authentication protocol ) org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28040: No matching authentication protocol ) 配置:jdk 1.6 tomcat7 首先,数据库是远程库,我动不了 然后根据网上的提示,找到了如下方法: 1.ojdbc14.jar替换成 ojdbc6.jar; 2.把数据库12c下的jar包替换到Java里,然后把Java项目里的sqljdbc.jar删掉 但是都没法用。 所以请教一下,麻烦描述的详细一下。 问答

oracle 11.2.0.4 账户被锁的问题

06-09

请教各位一个问题! 目前数据库(单机文件系统)11.2.0.3版本,web端使用连接池连接数据库用户user/password正常。 升级到oracle 11.2.0.4版本并打完建议的补丁集后,同样的客户端连接到11.2.0.4的用户user/password用户被锁,提示用户名密码错误。 我修改系统参数密码不区分大小写验证-无效 解锁账户后,设置错误密码无限制次数连接,这样我在oracle账户下使用sqlplus user/password登录卡住,无法登录。很久才能登录进去,或者提示tns异常问题。 请各位高手指点上述问题可能引起的原因。 web 日志 09-Jun-2017 18:12:02.244 WARNING [C3P0PooledConnectionPoolManager[identityToken->1hge3nw9o12xef2j1y0tsbn|30a044a7, dataSourceName->hibernate-datasource]-HelperThread-#0] com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$WarnLogger.log Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@d0bcbac is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests. 09-Jun-2017 18:12:12.246 WARNING [C3P0PooledConnectionPoolManager[identityToken->1hge3nw9o12xef2j1y0tsbn|30a044a7, dataSourceName->hibernate-datasource]-HelperThread-#2] com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$WarnLogger.log com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@166de721 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (1). Last acquisition attempt exception: java.sql.SQLException: ORA-01017: invalid username/password; logon denied at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:388) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:381) at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:564) at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186) at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366) at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696) 有人能指导下上述问题出在什么地方不? 我们搞java的好像也无多大办法了。 我自己用jdbc 开多线程连接并无异常,c3p0 开始启动的时候业务异常,但是启动一段时间后就报上述用户名和密码错误。 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览