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

2013-2-6 10:17:23 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet action threw exceptionjava.sql.SQLException: ORA-01017: invalid username/password; logon deniedat oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)at oracle.jdbc.ttc7.O3log.receive2nd(O3log.java:496)at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:278)at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:346)at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:200)at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)at $Proxy0.getList(Unknown Source)at st.sp.ib.action.UserAction.list(UserAction.java:35)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at st.sp.ib.filters.LocalSessionFilter.doFilter(LocalSessionFilter.java:34)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)at java.lang.Thread.run(Thread.java:619)




以上错误! 是我在搭建string+truts+ibatis框架的时候用spring链接oracle数据库的时候报的错误! 在网上找了很多的资料。


总结一下2点来解决这个错误!  


总体来看:invalid username/password  

字面意思是:无效的用户名/密码。那么可以从一下2点来看:


首先最重要的一点你要确定你的账号密码可以登录plsql。

1:用系统用户登录plsql , 查询当前的所有用户: select * from dba_users;   查看状态是否被锁(LOCKED ),如果你数据库连接的用户被锁,

.给帐号解锁
alter user user1 account unlock;   有很多是用户被锁了导致的。


2.我是更换了一个用户才解决这个问题的。重新create一个用户,把报错的用户的所有权限转到新的用户上面,这个就解决问题啦。


3.还有就是一个登陆 sysdba和Normal的问题,有很多的时候就是这个问题困扰了开发者。解决办法

A.put("user",admin);//用户

  A.put("password",admin); //密码

   有些连接时这样的代码,如果是oralce数据库的话,报上面你的错。你可以试着把下面的代码加上!

  A.put("internal_logon","sysdba");


希望能帮到你们! 







你可能感兴趣的:(java.sql.SQLException: ORA-01017: invalid username/password; logon denied)