Problème de connexion à MySQL via Hibernate
Bonsoir;
Je développe une application web utilisant Hibernate et Spring (IoC, MVC) et MySQL.
J'ai fait des test sous le console, l'interrogation de données se fait parfaitement.
Quand j'ai passé à la couche web sous Tomcat, la connexion avec MySQL via Hibernate m'affichera l'erreur suivant :
Code:
org.hibernate.exception.JDBCConnectionException: Could not open connection
voici mon fichier de configuration hibernate.cfg.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/bd_gest_comptes</property>
<property name="hibernate.connection.pool_size">3</property>
<property name="hibernate.connection.autocommit">true</property>
<property name="current_session_context_class">thread</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">monPass</property>
<!--property name="hibernate.hbm2ddl.auto">create</property -->
<mapping resource="dao/entites/Client.hbm.xml" />
<mapping resource="dao/entites/Operation.hbm.xml" />
<mapping resource="dao/entites/Compte.hbm.xml" />
</session-factory>
</hibernate-configuration> |
Quelqu'un peut m'aider SVP ?
Problème de connexion à MySQL via Hibernate
- tomcat est sur le même serveur que ta bd ?
Oui
- tu parles de quelle console ? IDE, terminal ?
Le console d'eclipse
- le fichier de conf hibernate est-il bien lu par tomcat ?
Oui, les données sont bien chargés de la BD dans une classe de test avec la méthode main()
Mais lorsque je veux afficher les données dans une page web, les erreus suivants s'affichent :
Code:
1 2 3 4 5
| Jun 08, 2012 5:04:53 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 0, SQLState: 08001
Jun 08, 2012 5:04:53 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: No suitable driver found for jdbc:mysql://localhost:3306/bd_gest_comptes
org.hibernate.exception.JDBCConnectionException: Could not open connection |
Code:
1 2 3
| Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/bd_gest_comptes
at java.sql.DriverManager.getConnection(DriverManager.java:604)
at java.sql.DriverManager.getConnection(DriverManager.java:190) |
SVP, ce problème me bloque depuis 3 jours, y'a t-il une solution