用hibernate连接数据库

时间:2015-07-28 09:56:10

标签: mysql hibernate

我知道这是一个已知问题,我做了我的研究,但仍然找不到合适的答案和做什么,所以我最后的希望就在这里。问题是,当我使用phpAdmin时,我可以在m数据库中连接并创建我的表。但是当我运行hibernates连接向导时,在输入连接属性后,如果我按下测试连接,它会给我这个错误:

"Timeout expired. IDE unable to establish connection. Check your proxy settings or try again later. The server may be unavailable at the moment.   You may also want to make sure that your firewall is not blocking network traffic."  

我的hibernate.cfg.xml看起来像这样

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://127.11.83.2:3306</property>
    <property name="hibernate.connection.username">admin1s6nbcM</property>
    <property name="hibernate.connection.password">*******</property>
  </session-factory>
</hibernate-configuration>

我怀疑MySQL Java Connector库存在问题;

dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.30</version>
</dependency>

因为我在构建应用程序时收到此警告:

Some problems were encountered while building the effective model for cardsystelefonbuch:cardsystelefonbuch:war:1.0
'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: mysql:mysql-connector-java:jar -> version 5.1.25 vs 5.1.30 @ line 83, column 13

It is highly recommended to fix these problems because they threaten the stability of your build.

For this reason, future Maven versions might no longer support building such malformed projects. 

任何想法都将不胜感激!

0 个答案:

没有答案