Assuming that I am using Hibernate for a Java web application talking to MySQL database, what is the driver type that Hibernate is using.
Asked
Active
Viewed 1.3k times
4 Answers
9
Hibernate won't pick a specific JDBC driver type by itself. It depends all on the JDBC driver class you're providing yourself and the JRE version of the runtime environment. JDBC type 4 is introduced in Java 1.6 and the latest MySQL Connector/J release is a JDBC type 4 compatible driver.

BalusC
- 1,082,665
- 372
- 3,610
- 3,555
3
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/databaseName</property>
<property name="connection.username">user</property>
<property name="connection.password">password</property>
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hbm2ddl.auto">update</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">false</property>
</session-factory>
You should add these in your configuration file. Add the mysql-connector-java-5.1.0-bin.jar file to your classpath. Then try to run

aswininayak
- 933
- 5
- 22
- 39
1
driverClassName="com.mysql.jdbc.Driver"
And you need the actual driver jar which you can get from here:

Shivan Dragon
- 15,004
- 9
- 62
- 103
1
Its depends on the jar file which you are provide for JDBC connection for MySql or otther database.

Yagnesh Agola
- 4,556
- 6
- 37
- 50