数据库表不是使用Maven自动创建的

时间:2014-11-06 12:05:12

标签: java mysql eclipse maven

我一直在研究Maven项目,我在Eclipse中成功构建了项目但是数据库表没有自动创建,因此完全从Eclipse中删除了项目,并删除了.m2(repository)文件夹并使用<创建了新项目/ p>

导入 - &gt;现有的Maven项目......

仍然存在错误......

的pom.xml

<profile>
   <id>dev</id>
   <activation>
      <activeByDefault>true</activeByDefault>
   </activation>
   <properties>
     <db.url>jdbc:mysql://127.0.0.1:3306/dms</db.url>
     <db.username>root</db.username>
     <db.password>admin123</db.password>
     <db.defaultAutoCommit>false</db.defaultAutoCommit>
   </properties>
</profile>

db.properties

db.password=admin123
db.username=root
db.url=jdbc:mysql://127.0.0.1:3306/dms
db.schema=dms
db.dialect=org.hibernate.dialect.MySQLInnoDBDialect
db.driver=com.mysql.jdbc.Driver
db.defaultAutoCommit=false

也试过......

org.hibernate.dialect.MySQLDialect

来自TOMCAT服务器的错误

SEVERE: Servlet.service() for servlet [dms] in context with path [/dms] threw exception [Request     processing failed; nested exception is     org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session     for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open     connection] with root cause
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:926)

用户变量路径

C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;%M2_HOME%\bin

系统变量Path

长期坚持这一点,请给我一个指示!感谢

1 个答案:

答案 0 :(得分:0)

根错误消息是

  

拒绝访问用户'root'@'localhost'(使用密码:YES)

更改以下行可能会有所帮助

db.url=jdbc:mysql://127.0.0.1:3306/dms

db.url=jdbc:mysql://localhost:3306/dms