Little confused, is 'driverclassname' and 'hibernate.dialect' both referring to the mysql driver?
No, they are not. The driverclassname
is referring to, well, the driver class name which is the class from a given JDBC driver that implements java.sql.Driver
. The driver class name is driver specific.
When using MySQL's JDBC driver aka MySQL Connector/J, this class is com.mysql.jdbc.Driver
as explained in the MySQL Connector/J documentation:
The name of the class that implements
java.sql.Driver
in MySQL Connector/J
is com.mysql.jdbc.Driver
. (...)
And actually, they even provide instructions to use their driver with Spring. See the section 20.3.5.2.4. Using Connector/J with Spring.
The hibernate.dialect
is different, this configuration property is used to define the classname of a Hibernate org.hibernate.dialect.Dialect
which allows Hibernate to generate SQL optimized for a particular relational database. Again this is explained in the Hibernate documentation:
(...) The classname of a Hibernate
org.hibernate.dialect.Dialect
which
allows Hibernate to generate SQL
optimized for a particular relational
database.
e.g. full.classname.of.Dialect
In most cases Hibernate will actually
be able to choose the correct
org.hibernate.dialect.Dialect
implementation based on the JDBC
metadata returned by the JDBC driver.
For MySQL 5.x, you should use org.hibernate.dialect.MySQL5InnoDBDialect
if you are using InnoDB tables (this would be my recommendation) or org.hibernate.dialect.MySQL5Dialect
if you're not. See the section 3.4.1. SQL Dialects for a (non exhaustive) list.
Last point, the Maven part that you didn't even mention in your question... The MySQL JDBC driver is available in the Maven central repository and you should use a repository search engine (as I already suggested). For example, the following query:
http://www.jarvana.com/jarvana/search?search_type=project&project=mysql
allows to find the maven coordinates of the ultimate version in two clicks:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.13</version>
</dependency>
PS: I don't mean to be rude and I'm glad to help but you should really try to leverage the documentation of the products or frameworks you're using. What you're asking in this question is well documented (as I showed) and can be found easily. Learning to find basic information by yourself is a fundamental skill for a software developer in my opinion.