1

i am using MySQL workbench 5.2 CE database with a basic hibernate program at run time it give me error:

Caused by: org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver

this code in hibernate.cfg.xml:

<hibernate-configuration>
    <session-factory>
          <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="connection.url">jdbc:mysql://192.168.8.212/da?autoReconnect=true&amp;useOldUTF8Behavior=true&amp;useUnicode=true&amp;characterEncoding=UTF-8" /></property>
        <property name="connection.username">root</property>
        <property name="connection.password">password</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="myeclipse.connection.profile">MyEclipse Derby</property>
        </session-factory>
</hibernate-configuration>
1
  • This is unrelated but you have some extra garbage at the end of your connection.url string, remove them. It should be <property name="connection.url">jdbc:mysql://192.168.8.212/da?autoReconnect=true&amp;useOldUTF8Behavior=true&amp;useUnicode=true&amp;characterEncoding=UTF-8</property> Commented Aug 16, 2010 at 20:54

1 Answer 1

2

Put the mysql jdbc driver jar on your classpath - if it is a web application that is WEB-INF/lib

Sign up to request clarification or add additional context in comments.

2 Comments

i have put this in class path: Hibernate 3.3 Annotations & Entity Manager, Hibernate 3.3 Core Libraries, Hibernate 3.3 Advanced Support Libraries, derbyclient.jar - Hibernate_example/lib
and I have linked to the driver donwload page, from where you can obtain the jdbc driver, and also put it on the classpath.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.