(转)hibernate C3P0数据源 连接Access数据库
?<?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.xsd"><!-- 定义数据源Bean,使用C3P0数据源实现 --><bean id="dataSource"value="com.hxtt.sql.access.AccessDriver" /><!-- 指定连接数据库的URL --><property name="jdbcUrl"value="jdbc:access:///c:/你的Access的绝对路径" /><!-- 指定连接数据库的用户名 --><property name="user" value="" /><!-- 指定连接数据库的密码 --><property name="password" value="" /><!-- 指定连接数据库连接池的最大连接数 --><property name="maxPoolSize" value="40" /><!-- 指定连接数据库连接池的最小连接数 --><property name="minPoolSize" value="10" /><!-- 指定连接数据库连接池的初始化连接数 --><property name="initialPoolSize" value="10" /><!-- 指定连接数据库连接池的连接的最大空闲时间 --><property name="maxIdleTime" value="3" /></bean><!--定义了Hibernate的SessionFactory --><bean id="sessionFactory"ref="dataSource" /><!-- 配置Hibernate的参数 --><property name="hibernateProperties"><props><!-- 指定数据库的方言 --><prop key="hibernate.dialect">com.hxtt.support.hibernate.HxttAccessDialect</prop><prop key="show_sql">false</prop><prop key="hibernate.hbm2ddl.auto">update</prop><!-- JDBC执行批量更新语句的大小 清除缓存(定期清除缓存,减小压力 --><prop key="hibernate.jdbc.batch_size">30</prop></props></property><property name="mappingResources"><!-- 映射的文件 --><list><value>XXXX.hbm.xml</value></list></property></bean><!-- 配置事务管理器Bean,因为使用Hibernate持久化技术,故使用HibernateTranscationManager 事务管理器 --><bean id="transactionManager"ref="sessionFactory" /></bean><!-- 配置事务拦截器Bean --><bean id="transactionInterceptor"ref="transactionManager" /><property name="transactionAttributes"><!-- 下面定义事务传播属性--><props><prop key="save*">PROPAGATION_REQUIRED</prop><prop key="get*">PROPAGATION_REQUIRED,readOnly</prop><prop key="find*">PROPAGATION_REQUIRED,readOnly</prop><prop key="*">PROPAGATION_REQUIRED</prop></props></property></bean><!-- 定义BeanNameAutoProxyCreator 后处理器 ,BeanNameAutoProxyCreator为名字匹配字符串或者通配符的bean自动创建AOP代理。--><beanref="sessionFactory"></property></bean><!-- 配置系统的业务逻辑组件 --><bean id="xxxxImp" ref="xxxxDao"></property></bean></beans>
?jdbc:Access_JDBC30.jar
hibernate:hibernate.jar