The configuration file Applicationcontext.xml settings are as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
< beans xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-2.0.xsd ">
<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource" >
<!--connection mysql-->
< property name= "Driverclassname" value= "Com.mysql.jdbc.Driver" ></property>
< property name= "url" value= "Jdbc:mysql://localhost:3306/mytest" ></property>
< property name= "username" value= "root" ></property>
< property name= "password" value= "root" ></property>
<!--Connect Oracle--
< property name= "Driverclassname" value= "Oracle.jdbc.driver.OracleDriver" ></property>
< property name= "url" value= "Jdbc:oracle:thin: @localhost: 1521:orcl" ></property>
< property name= "username" value= "Scott" ></property>
< property name= "password" value= "Tiger" ></property>
<!--connecting SQL server-->
< property name= "Driverclassname" value= "Com.microsoft.sqlserver.jdbc.SQLServerDriver" ></property>
< property name= "url" value= "Jdbc:sqlserver://localhost:1433;databasename=test" ></property>
< property name= "username" value= "sa" ></property>
< property name= "password" value= "123" ></property>
< property name= "maxactive" value= "" "></property>
< property name= "Maxidle" value= "+" ></property>
< property name= "maxwait" value= "></property>"
< property name= "Defaultautocommit" value= "true" ></property>
</bean>
<bean id= "Sessionfactory" class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
< property name= "DataSource" ref= "DataSource" ></property>
< property name= "Hibernateproperties" >
< props>
<!--MySQL dialect---
< prop key= "Hibernate.dialect" >org.hibernate.dialect.MySQLDialect</prop>
<!--Oracle's dialect---
<prop key= "Hibernate.dialect" >org.hibernate.dialect.OracleDialect</prop>
<!--the dialect of SQL Server---
<prop key= "Hibernate.dialect" >org.hibernate.dialect.SQLServerDialect</prop>
< prop key= "Hibernate.show_sql" >true</prop>
</props>
</property>
< property name= "Mappingresources" >
< list>
< value>com/test/bean/user.hbm.xml</value>
</list>
</property>
</bean>
<bean id= "Userdao" class= "Com.test.dao.impl.UserDAOImpl" scope= "singleton" >
< property name= "Sessionfactory" > < ref bean= "Sessionfactory"/>
</property>
</bean>
<bean id= "UserService" class= "Com.test.service.impl.UserServiceImpl" >
< property name= "Userdao" ref= "Userdao" ></property>
</bean>
<bean id= "saveuseraction" class= "Com.test.action.user.SaveUserAction" scope= "prototype" >
< property name= "service" ref= "UserService" ></property>
</bean>
<bean id= "listuseraction" class= "Com.test.action.user.ListUserAction" scope= "prototype" >
< property name= "service" ref= "UserService" ></property>
</bean>
<bean id= "removeuseraction" class= "Com.test.action.user.RemoveUserAction" scope= "prototype" >
< property name= "service" ref= "UserService" ></property>
</bean>
</beans>
Spring Connect Database Motion connection properties for MySQL, Oracle, and SQL Server