i have spring configured use hsql, use mysql. needs change?
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver" p:prefix="/web-inf/jsp/" p:suffix=".jsp" /> <bean id="mydatasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="org.hsqldb.jdbcdriver"/> <property name="url" value="jdbc:hsqldb:hsql://localhost:9001"/> <property name="username" value="monty"/> <property name="password" value="indian"/> </bean> <bean id="mysessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean"> <property name="datasource" ref="mydatasource" /> <property name="annotatedclasses"> <list> <value>uk.co.vinoth.spring.domain.user</value> </list> </property> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.hsqldialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">create</prop> </props> </property> </bean> <bean id="myuserdao" class="uk.co.vinoth.spring.dao.userdaoimpl"> <property name="sessionfactory" ref="mysessionfactory"/> </bean> <bean name="/user/*.htm" class="uk.co.vinoth.spring.web.usercontroller" > <property name="userdao" ref="myuserdao" /> </bean> </beans>
change following properties:
<property name="driverclassname" value="com.mysql.jdbc.driver"/> <property name="url" value="jdbc:mysql://127.0.0.1:3306/schema"/> <prop key="hibernate.dialect">org.hibernate.dialect.mysqldialect</prop>
(where 'schema' mysql database name, assuming mysql host 127.0.0.1)
and add mysql-connector jar classpath.
Comments
Post a Comment