[Hibernate] Probléme de connection à un serveur Mysql
Bonjour,
j'utilise Hibernate3 et MyEclipse comme IDE, avec une BDD mysql.
Lorsque je me connecte à la BDD mysql par un utilisateur local, je me connecte très : et voici le fichier de hibernate.cfg.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost/BDD
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<mapping resource="hiber/table.hbm.xml" />
</session-factory> |
mais dés que je me connecte au serveur et je met l'adresse IP du serveur pour se connecter à la base Mysql Serveur, par :
Code:
1 2 3
| <property name="connection.url">
jdbc:mysql://100.100.10.1/BDD
</property> |
j'ai l'erreur suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:129)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1290)
at show.Test.main(Test.java:31)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused: connect
STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection refused: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:129)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1290)
at show.Test.main(Test.java:31)
** END NESTED EXCEPTION ** |
J'arrive pas à ce connecter, sachant que j'accède via le web grâce à l'adresse :
http://100.100.10.1/home/mysql/ et aussi par : http://127.0.0.1/home/mysql/
je me connecte très bien.
j'utilise la BDD phpMyAdmin - 2.9.1.1.
J'aurais besoin de votre aide.
Merci