Assuming that I am using Hibernate for a Java web application talking to MySQL database, what is the driver type that Hibernate is using.
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.
<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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With