Error updating database. Cause:java.sql.SQLException:Access denied for user ' ${username} ' @ ' localhost ' (using Password:yes)

Source: Internet
Author: User

Importing someone else's project, an error has been made, and the user name in the Db.properties profile is inconsistent with the user name that is called in the Mybatis-conf.xml configuration file.

(The nameis used in db.properties, and the real username , or ${username}, is called), as long as the name in the configuration file is changed to username.

As follows:

org.apache.ibatis.exceptions.PersistenceException: # # # Error updating database. Cause:java.sql.SQLException:Access denied forUser'  ${username}'@'localhost' (using  password: YES) # # Cause:java.sql.SQLException:Access denied forUser'${username}'@'localhost'(usingPassword:yes) at Org.apache.ibatis.exceptions.ExceptionFactory.wrapException (Exceptionfactory.java: -) at Org.apache.ibatis.session.defaults.DefaultSqlSession.update (Defaultsqlsession.java: $) at Org.apache.ibatis.session.defaults.DefaultSqlSession.insert (Defaultsqlsession.java:185) at DbBookTest.StudentCERUDTest.add (Studentcerudtest.java: -) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java: +) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java: +) at Java.lang.reflect.Method.invoke (Method.java:498) at org.junit.runners.model.frameworkmethod$1. Runreflectivecall (Frameworkmethod.java: -) at Org.junit.Internal. Runners.model.ReflectiveCallable.run (Reflectivecallable.java: A) at org.junit.runners.model.FrameworkMethod.invokeExplosively (Frameworkmethod.java: -) at Org.junit.Internal. Runners.statements.InvokeMethod.evaluate (Invokemethod.java: -) at Org.junit.runners.ParentRunner.runLeaf (Parentrunner.java:325) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (Blockjunit4classrunner.java: +) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (Blockjunit4classrunner.java: $) at org.junit.runners.parentrunner$3. Run (Parentrunner.java:290) at org.junit.runners.parentrunner$1. Schedule (Parentrunner.java: in) at Org.junit.runners.ParentRunner.runChildren (Parentrunner.java:288) at org.junit.runners.parentrunner.access$ the(Parentrunner.java: -) at org.junit.runners.parentrunner$2. Evaluate (Parentrunner.java:268) at Org.junit.runners.ParentRunner.run (Parentrunner.java:363) at ORG.ECLIPSE.JDT.Internal. Junit4.runner.JUnit4TestReference.run (Junit4testreference.java: the) at ORG.ECLIPSE.JDT.Internal. Junit.runner.TestExecution.run (Testexecution.java: -) at ORG.ECLIPSE.JDT.Internal. junit.runner.RemoteTestRunner.runTests (Remotetestrunner.java:538) at ORG.ECLIPSE.JDT.Internal. junit.runner.RemoteTestRunner.runTests (Remotetestrunner.java:760) at ORG.ECLIPSE.JDT.Internal. Junit.runner.RemoteTestRunner.run (Remotetestrunner.java:460) at ORG.ECLIPSE.JDT.Internal. Junit.runner.RemoteTestRunner.main (Remotetestrunner.java:206) caused By:java.sql.SQLException:Access denied forUser'${username}'@'localhost'(usingPassword:yes) at Com.mysql.jdbc.SQLError.createSQLException (Sqlerror.java:1055) at Com.mysql.jdbc.SQLError.createSQLException (Sqlerror.java:956) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:3536) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:3468) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:917) at com.mysql.jdbc.MysqlIO.secureAuth411 (Mysqlio.java:3974) at Com.mysql.jdbc.MysqlIO.doHandshake (Mysqlio.java:1282) at Com.mysql.jdbc.ConnectionImpl.createNewIO (Connectionimpl.java:2142) at Com.mysql.jdbc.ConnectionImpl.<init> (Connectionimpl.java:773) at com.mysql.jdbc.JDBC4Connection.<init> (Jdbc4connection.java: $) at Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at Sun.reflect.NativeConstructorAcce Ssorimpl.newinstance (Nativeconstructoraccessorimpl.java: +) at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (Delegatingconstructoraccessorimpl.java: $) at Java.lang.reflect.Constructor.newInstance (Constructor.java:423) at Com.mysql.jdbc.Util.handleNewInstance (Util.java:406) at Com.mysql.jdbc.ConnectionImpl.getInstance (Connectionimpl.java:352) at Com.mysql.jdbc.NonRegisteringDriver.connect (Nonregisteringdriver.java:282) at Java.sql.DriverManager.getConnection (Drivermanager.java:664) at Java.sql.DriverManager.getConnection (Drivermanager.java:208) at Org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection (Unpooleddatasource.java:201) at Org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection (Unpooleddatasource.java:196) at Org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection (Unpooleddatasource.java: the) at Org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection (Pooleddatasource.java:404) at Org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection (Pooleddatasource.java: -) at Org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection (Jdbctransaction.java:139) at Org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection (Jdbctransaction.java: A) at Org.apache.ibatis.executor.BaseExecutor.getConnection (Baseexecutor.java:336) at Org.apache.ibatis.executor.SimpleExecutor.prepareStatement (Simpleexecutor.java: -) at Org.apache.ibatis.executor.SimpleExecutor.doUpdate (Simpleexecutor.java: the) at Org.apache.ibatis.executor.BaseExecutor.update (Baseexecutor.java:117) at Org.apache.ibatis.executor.CachingExecutor.update (Cachingexecutor.java: the) at Org.apache.ibatis.session.defaults.DefaultSqlSession.update (Defaultsqlsession.java:198)    ...  -More

Error updating database. Cause:java.sql.SQLException:Access denied for user ' ${username} ' @ ' localhost ' (using Password:yes)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.