Home > Back-end >  The idea to use JDBC run mybatis can't connect MySQL
The idea to use JDBC run mybatis can't connect MySQL

Time:10-11

Password user name right, MySQL privileges also opened, code that's true, but even not on the database,
This is the problem hint:
. Loading class ` com. Mysql. JDBC Driver '. This is deprecated. The new Driver class is ` com. Mysql. Cj. JDBC. The Driver '. The Driver is automatically registered via The SPI and manual Loading of The Driver class is generally unnecessary.

Org. Apache. Ibatis. Exceptions. PersistenceException:
# # # Error updating the database. Cause: org. Apache. Ibatis. Executor. ExecutorException: Error selecting key or setting the result to the parameter object. The Cause: Java, SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)
# # # The error may exist in The com/ch07/mapper/CustomerMapper. XML
# # # The error may involve com. Ch07. Mapper. CustomerMapper. InsertCustomer! SelectKey
# # # The error occurred while executing a query
# # # Cause: org. Apache. Ibatis. Executor. ExecutorException: Error selecting key or setting the result to the parameter object. The Cause: Java, SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)

The at org. Apache. Ibatis. Exceptions. ExceptionFactory. WrapException (30) ExceptionFactory. Java:
The at org. Apache. Ibatis. Session. Defaults. DefaultSqlSession. Update (DefaultSqlSession. Java: 200)
The at org. Apache. Ibatis. Session. Defaults. DefaultSqlSession. Insert (185) DefaultSqlSession. Java:
At com. Ch07. MybatisTest. AddCustomerTest (MybatisTest. Java: 38)
At sun. Reflect. NativeMethodAccessorImpl. Invoke0 (Native Method)
At sun. Reflect. NativeMethodAccessorImpl. Invoke (NativeMethodAccessorImpl. Java: 62)
At sun. Reflect. DelegatingMethodAccessorImpl. Invoke (43) DelegatingMethodAccessorImpl. Java:
The at Java. Lang. Reflect. Method. Invoke (498) Method. The Java:
The at org. Junit. Runners. Model. FrameworkMethod $1. RunReflectiveCall (FrameworkMethod. Java: 50)
The at org. Junit. Internal. Runners. Model. ReflectiveCallable. Run (ReflectiveCallable. Java: 12)
The at org. Junit. Runners. Model. FrameworkMethod. InvokeExplosively (FrameworkMethod. Java: 47)
The at org. Junit. Internal. Runners. Statements. InvokeMethod. Evaluate (InvokeMethod. Java: 17)
The at org. Junit. Runners. ParentRunner. RunLeaf (ParentRunner. Java: 325)
The at org. Junit. Runners. BlockJUnit4ClassRunner. RunChild (BlockJUnit4ClassRunner. Java: 78)
The at org. Junit. Runners. BlockJUnit4ClassRunner. RunChild (BlockJUnit4ClassRunner. Java: 57)
The at org. Junit. Runners. ParentRunner $3. The run (ParentRunner. Java: 290)
The at org. Junit. Runners. ParentRunner $1. The schedule (ParentRunner. Java: 71)
The at org. Junit. Runners. ParentRunner. RunChildren (ParentRunner. Java: 288)
The at org. Junit. Runners. ParentRunner. Access the $000 (ParentRunner. Java: 58)
At org. Junit. Runners. ParentRunner $2. The evaluate (ParentRunner. Java: 268)
The at org. Junit. Runners. ParentRunner. Run (ParentRunner. Java: 363)
The at org. Junit. Runner. JUnitCore. Run (JUnitCore. Java: 137)
At com. Intellij. Takeup. JUnit4IdeaTestRunner. StartRunnerWithArgs (JUnit4IdeaTestRunner. Java: 69)
At com. Intellij. Rt. Junit. IdeaTestRunner $Repeater. StartRunnerWithArgs (IdeaTestRunner. Java: 33)
At com. Intellij. Rt. Junit. JUnitStarter. PrepareStreamsAndStart (JUnitStarter. Java: 220)
At com. Intellij. Rt. Junit. JUnitStarter. Main (53) JUnitStarter. Java:
Under Caused by: org. Apache. Ibatis. Executor. ExecutorException: Error selecting key or setting the result to the parameter object. The Cause: Java, SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)
The at org. Apache. Ibatis. Executor. The keygen. SelectKeyGenerator. ProcessGeneratedKeys (SelectKeyGenerator. Java: 92)
The at org. Apache. Ibatis. Executor. The keygen. SelectKeyGenerator. ProcessBefore (SelectKeyGenerator. Java: 47)
The at org. Apache. Ibatis. Executor. Statement. BaseStatementHandler. GenerateKeys (BaseStatementHandler. Java: 141)
The at org. Apache. Ibatis. Executor. Statement. BaseStatementHandler. & lt; Init> (BaseStatementHandler. Java: 63)
The at org. Apache. Ibatis. Executor. Statement. PreparedStatementHandler. & lt; Init> (PreparedStatementHandler. Java: 41)
The at org. Apache. Ibatis. Executor. Statement. RoutingStatementHandler. & lt; Init> (RoutingStatementHandler. Java: 46)
At org. Apache. Ibatis. Session. The Configuration. NewStatementHandler (563) Configuration. Java:
The at org. Apache. Ibatis. Executor. SimpleExecutor. DoUpdate (SimpleExecutor. Java: 48)
The at org. Apache. Ibatis. Executor. BaseExecutor. Update (BaseExecutor. Java: 117)
The at org. Apache. Ibatis. Executor. CachingExecutor. Update (CachingExecutor. Java: 76)
The at org. Apache. Ibatis. Session. Defaults. DefaultSqlSession. Update (DefaultSqlSession. Java: 198)
. 24 more
Under Caused by: Java. SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 129)
At com. Mysql. Cj. JDBC. Exceptions. SQLError. CreateSQLException (SQLError. Java: 97)
At com. Mysql. Cj. JDBC. Exceptions. SQLExceptionsMapping. TranslateException (SQLExceptionsMapping. Java: 122)
At com. Mysql. Cj. JDBC. ConnectionImpl. CreateNewIO (ConnectionImpl. Java: 836)
At com. Mysql. Cj. JDBC. ConnectionImpl. & lt; Init> (ConnectionImpl. Java: 456)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related