Sunday, June 17, 2012

Configuration for Hibernate with MySQL


First we need to include the jar for MySql driver mysql-connector-java-5.1.20-bin.jar can be found on MySql site.

Then we need to configure its data source in application-servlet.xml file :

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
                  <property name="url" value="jdbc:mysql://localhost:3306/yourDatabaseName" />
                  <property name="username" value="root" />
                   <property name="password" value="root" />
  </bean>

Make sure your database service is on and you are happy to go.

No comments:

Post a Comment