JDBC Driver类

问题描述:

我有与Hibernate的配置有问题,当我运行的类测试affich:JDBC Driver类

creating session factory 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Environment <clinit> 
INFO: Hibernate 2.1.6 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Environment <clinit> 
INFO: hibernate.properties not found 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Environment <clinit> 
INFO: using CGLIB reflection optimizer 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Configuration configure 
INFO: configuring from file: hibernate.cfg.xml 
3 mai 2011 09:47:51 net.sf.hibernate.cfg.Configuration addResource 
INFO: Mapping resource: org/domain/projet/config/Employe.hbm.xml 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Binder bindRootClass 
INFO: Mapping class: org.domain.projet.config.Employe -> employe 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration doConfigure 
INFO: Configured SessionFactory: 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration secondPassCompile 
INFO: processing one-to-many association mappings 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration secondPassCompile 
INFO: processing one-to-one association property references 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration secondPassCompile 
INFO: processing foreign key constraints 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.SettingsFactory buildSettings 
ATTENTION: No dialect set - using GenericDialect: Dialect class not found: org.hibernate.dialect.MySQLDialect 
3 mai 2011 09:47:52 net.sf.hibernate.dialect.Dialect <init> 
INFO: Using dialect: net.sf.hibernate.dialect.GenericDialect 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.SettingsFactory buildSettings 
INFO: Use outer join fetching: true 
3 mai 2011 09:47:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 
INFO: Using Hibernate built-in connection pool (not for production use!) 
3 mai 2011 09:47:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 
INFO: Hibernate connection pool size: 1 
JDBC Driver class not found: com.jdbc.mysql.driver 
3 mai 2011 09:47:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 
GRAVE: JDBC Driver class not found: com.jdbc.mysql.driver 

你在你的classpath需要mysql-connector-*.jar

+0

但我有连接器为MySQL 5.0,但没有工作:(我放在Hibernate配置文件中: com.jdbc.mysql.driver user726991 2011-05-03 09:11:24

尝试使用这些属性值:

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> 
... 
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property> 

检查hibernate3.jar是否也在您的路径中。

+0

谢谢,我发现错误是net.fr.hibernate.dialect.MYSQLDialect :) – user726991 2011-05-03 10:12:20

JDBC Driver class not found: com.jdbc.mysql.driver

全限定类名是区分大小写的。您需要在您的Hibernate配置文件中声明com.mysql.jdbc.Driver大写D,而不是com.mysql.jdbc.driver小写d