ssh 框架常用的3中数据库连接池
1.sqlserver2000<?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/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd"><!-- Hibernate SessionFactory --> <bean id="sessionFactory" /> </property> <property name="mappingResources"> <list> <value>com/oy/image/model/LoginUser.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.connection.release_mode">auto</prop> <prop key="hibernate.autoReconnect">true</prop> </props> </property> </bean> <bean id="dataSource" name="imageDao" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean id="imageManager" name="imageManager" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="imageDao"> <ref bean="imageDao" /> </property> </bean> </beans>2.mysql<?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/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd"><bean id="dataSource" /> </property> <property name="mappingResources"> <list> <value>com/oy/image/model/LoginUser.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.connection.release_mode"> auto </prop> <prop key="hibernate.autoReconnect">true</prop> </props> </property> </bean> <bean id="imageDao" name="imageDao" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean id="imageManager" name="imageManager" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="imageDao"> <ref bean="imageDao" /> </property> </bean> </beans>3.oracle <?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/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd"><bean id="dataSource" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="driverClass"> <value>oracle.jdbc.driver.OracleDriver</value> </property> <property name="jdbcUrl"> <value>jdbc:oracle:thin:@192.168.0.1:1521:orcl</value> </property> <property name="user"> <value>username</value> </property> <property name="password"> <value>password</value> </property> <property name="minPoolSize"> <value>10</value> </property> <property name="maxPoolSize"> <value>20</value> </property> <property name="initialPoolSize"> <value>10</value> </property> </bean> <bean id="sessionFactory" name="imageDao" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean id="imageManager" name="imageManager" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="imageDao"> <ref bean="imageDao" /> </property> </bean> </beans>
?