当前位置: 代码迷 >> J2EE >> ORA-01017: invalid username/password; logon denied解决方法
  详细解决方案

ORA-01017: invalid username/password; logon denied解决方法

热度:831   发布时间:2016-04-21 20:17:35.0
ORA-01017: invalid username/password; logon denied
tomcat在启动的最后就会报这个错误,搞了半天解决不了,用户名和密码都是对的
求大神指点
我的项目数据库原来是oracle10g的,导出方案后现在又导入到oracle11g,用户也是新建的,并赋予connect和resource权限,是权限的问题嘛

java.sql.SQLException: ORA-01017: invalid username/password; logon denied

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:330)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:277)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:790)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:361)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:438)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
DEBUG 2012-09-29 11:58:21,101 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask: An exception occurred while acquiring a poolable resource. Will retry.

上面是完整的错误信息
我的用户名和密码是对的

#**********db set***************#
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:myora
username=kael
password=kael
minPoolSize=5
maxPoolSize=50
maxIdleTime=1800
acquireIncrement=3
maxStatements=1000
initialPoolSize=5
idleConnectionTestPeriod=60
acquireRetryAttempts=30
testConnectionOnCheckout=false
breakAfterAcquireFailure=false
acquireRetryDelay=100



<context:property-placeholder location="classpath:db.properties,classpath:constant.properties" ignore-unresolvable="true"/>

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>${driverClassName}</value>
</property>
<property name="jdbcUrl">
<value>${url}</value>
</property>
<property name="user">
<value>${username}</value>
</property>
<property name="password">
<value>${password}</value>
</property>
<!--连接池中保留的最小连接数。 -->
<property name="minPoolSize">
<value>${minPoolSize}</value>
</property>
<!--连接池中保留的最大连接数。Default: 15 -->
<property name="maxPoolSize"  >
<value>${maxPoolSize}</value>
</property>
<!--最大空闲时间,若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime">
<value>${maxIdleTime}</value>
</property>
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement">
<value>${acquireIncrement}</value>
</property>
<property name="maxStatements">
<value>${maxStatements}</value>
</property>
<property name="initialPoolSize">
<value>${initialPoolSize}</value>
</property>
<!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
<property name="idleConnectionTestPeriod">
<value>${idleConnectionTestPeriod}</value>
</property>
<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts">
<value>${acquireRetryAttempts}</value>
</property>
<property name="breakAfterAcquireFailure" >
<value>${breakAfterAcquireFailure}</value>
</property>
<property name="testConnectionOnCheckout">
<value>${testConnectionOnCheckout}</value>
</property>
<property name="acquireRetryDelay">
      <value>${acquireRetryDelay}</value>
</property>
</bean>


这是spring配置

------解决方案--------------------
username=kael    后面有空格看到没有?
------解决方案--------------------
先尝试用sqlplus或其它啥工具,用相同的帐号密码,远程登录数据库试试看。
  相关解决方案