配置c3po数据
来源:互联网 发布:bt离线下载软件 编辑:程序博客网 时间:2024/05/29 18:52
1.db.properties的配置
jdbc.user=root
jdbc.password=root
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql:///spring
jdbc.initPoolSize=5
jdbc.maxPoolSize=10
2.applicationContext.xml的配置
<?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:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="com.atguigu.spring"></context:component-scan>
<!-- 导入资源文件 -->
<context:property-placeholder location="classpath:db.properties"/>
<!-- 配置 C3P0 数据源 -->
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="initialPoolSize" value="${jdbc.initPoolSize}"></property>
<property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
</bean>
<!-- 配置 Spirng 的 JdbcTemplate -->
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 配置 NamedParameterJdbcTemplate, 该对象可以使用具名参数, 其没有无参数的构造器, 所以必须为其构造器指定参数 -->
<bean id="namedParameterJdbcTemplate"
class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg ref="dataSource"></constructor-arg>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 启用事务注解 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
- 配置c3po数据
- c3po配置
- JDBC数据库连接池c3po配置
- ssh开发c3po数据源配置
- c3po数据库连接池简单配置
- Hibernate 连接池配置(C3PO and proxool)
- DBCP和C3PO数据源的配置
- DBCP和C3PO数据源的配置
- spring的数据源配置DBCP,C3PO,BoneCP
- C3PO连接池配置及其详解
- SSH中 c3po 配置和事务处理配置(注解方式)
- 数据连接池用法(boncp,dbcp,proxool,C3PO)
- 数据连接池用法(boncp,dbcp,proxool,C3PO)
- 数据连接池用法(boncp,dbcp,proxool,C3PO)
- Spring配置数据源的三种方式 (JNDI\C3PO)
- c3po.properties
- Spring3.1.2框架下c3po和dbcp两种数据库连接池的配置
- Spring3.1.2框架下c3po和dbcp两种数据库连接池的配置
- 终于决定开始决定要写博客了
- ubuntu远程桌面连接windows系统
- 欢迎使用CSDN-markdown编辑器
- 测试连通性(Java实现)
- 清晰对焦的概念
- 配置c3po数据
- windows学习笔记1 窗口
- ubuntu下shell 持续更新
- Linux设备模型——设备驱动模型和sysfs文件系统解读
- Chapter 4 suspend和resume方法
- 解决VirtualBox cannot start the virtual device
- android studio中修改快捷键以及实用的开发快捷键,方便技巧
- 简图记录-金字塔原理
- linux共享内存的理解