<BeanID= "DataSource"class= "Org.apache.commons.dbcp.BasicDataSource" > < Propertyname= "Driverclassname"> <!--<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value> - <value>Com.mysql.jdbc.Driver</value> </ Property> < Propertyname= "url"> <!--<value>jdbc:sqlserver://192.168.2.186:1433;DatabaseName=test2013</value> - <value>Jdbc:mysql://127.0.0.1:3306/ssh4</value> </ Property> < Propertyname= "username"> <value>Root</value> </ Property> < Propertyname= "Password"> <value>Root</value> </ Property> </Bean> <BeanID= "Sessionfactory"class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!--setting of the data source - < Propertyname= "DataSource"> <refLocal= "DataSource"/> </ Property> < Propertyname= "Mappingresources"> <List> <value>Com/zhangyue/bean/zycstudent.hbm.xml</value> <value>Com/zhangyue/bean/zyccourse.hbm.xml</value> <value>Com/zhangyue/bean/zycstudentcourse.hbm.xml</value> <value>Com/zhangyue/bean/zycstudentfile.hbm.xml</value> </List> </ Property> < Propertyname= "Hibernateproperties"> <Props> <propKey= "Hibernate.dialect"> <!--Org.hibernate.dialect.SQLServerDialect -Org.hibernate.dialect.MySQLDialect</prop> <propKey= "Hibernate.hbm2ddl.auto">Update</prop> <propKey= "Hibernate.show_sql">True</prop> </Props> </ Property> </Bean>
Above is the MySQL version (SQL Server version):
The following is the Oracle version:
<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource" >
<property name= "Driverclassname" >
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name= "url" >
<value>jdbc:oracle:thin:@192.168.1.21:1521:orcl</value>
</property>
<property name= "username" >
<value>test</value>
</property>
<property name= "Password" >
<value>test</value>
</property>
</bean>
<bean id= "Sessionfactory" class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<!--data source settings--
<property name= "DataSource" >
<ref local= "DataSource"/>
</property>
<property name= "Mappingresources" >
<list>
<value>com/test/bean/User.hbm.xml</value>
</list>
</property>
<property name= "Hibernateproperties" >
<props>
<prop key= "Hibernate.dialect" >
Org.hibernate.dialect.OracleDialect
</prop>
<prop key= "Hibernate.show_sql" >
True
</prop>
</props>
</property>
</bean>