这个sql异常是那里的错

log4j打印的信息:

00:33:06,805  INFO Version:37 - Hibernate Commons Annotations 3.2.0.Final

00:33:06,840  INFO Environment:603 - Hibernate 3.6.10.Final
00:33:06,846  INFO Environment:636 - hibernate.properties not found
00:33:06,857  INFO Environment:814 - Bytecode provider name : javassist
00:33:06,867  INFO Environment:695 - using JDK 1.4 java.sql.Timestamp handling
00:33:07,098  INFO Configuration:2156 - configuring from resource: /hibernate.cfg.xml
00:33:07,099  INFO Configuration:2175 - Configuration resource: /hibernate.cfg.xml
00:33:07,391  INFO Configuration:789 - Reading mappings from resource : hibranate/itcast/demo/Customer.hbm.xml
00:33:07,632  INFO Configuration:2297 - Configured SessionFactory: null
00:33:07,809  INFO HbmBinder:353 - Mapping class: hibranate.itcast.demo.Customer -> customer
00:33:07,872  INFO Configuration:1676 - Hibernate Validator not found: ignoring
00:33:07,889  INFO HibernateSearchEventListenerRegister:75 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
00:33:07,908  INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
00:33:07,908  INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20
00:33:07,909  INFO DriverManagerConnectionProvider:68 - autocommit mode: false
00:33:07,924  INFO DriverManagerConnectionProvider:103 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///hibernate3_day01
00:33:07,930  INFO DriverManagerConnectionProvider:109 - connection properties: {user=root}

00:33:08,318  WARN SettingsFactory:147 - Could not obtain connection to query metadata

异常:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3269)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1182)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2670)
at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
at hibranate.itcast.demo.HibrenateText.Demo1(HibrenateText.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
00:33:08,406  INFO Dialect:136 - Using dialect: org.hibernate.dialect.MySQLDialect
00:33:08,441  INFO JdbcSupportLoader:70 - Disabling contextual LOB creation as connection was null
00:33:08,445  INFO TransactionFactoryFactory:62 - Using default transaction strategy (direct JDBC transactions)
00:33:08,453  INFO TransactionManagerLookupFactory:83 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
00:33:08,454  INFO SettingsFactory:179 - Automatic flush during beforeCompletion(): disabled


学无丶直径
浏览 1878回答 2
2回答

习惯受伤

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)你没有给密码吧?无法访问数据库的错误
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java