Reputation: 791
Assuming that I am using Hibernate for a Java web application talking to MySQL database, what is the driver type that Hibernate is using.
Upvotes: 4
Views: 13768
Reputation: 1108722
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.
Upvotes: 9
Reputation: 973
<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
Upvotes: 3
Reputation: 4639
Its depends on the jar file which you are provide for JDBC connection for MySql or otther database.
Upvotes: 1
Reputation: 15219
driverClassName="com.mysql.jdbc.Driver"
And you need the actual driver jar which you can get from here:
http://dev.mysql.com/downloads/connector/j/5.0.html
Upvotes: 1