DBCP 配置文件加Java code
来源:互联网 发布:加入淘宝商城条件 编辑:程序博客网 时间:2024/06/05 05:30
#Driver
driverClassName=com.mysql.jdbc.Driver
#UrL
url=jdbc:mysql://192.168.111.15:3306/archive_reader
#User name
username=trafficcast
#Password
password=naitou
#The initial number of connections that are created when the pool is started.
initialSize=10
#The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
maxActive=50
#The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.
maxIdle=20
#The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none.
minIdle=5
#The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely.
maxWait=60000
#The connection properties that will be sent to our JDBC driver when establishing new connections.
connectionProperties=useUnicode=true;characterEncoding=gbk
#The default auto-commit state of connections created by this pool.
defaultAutoCommit=true
#The default read-only state of connections created by this pool. If not set then the setReadOnly method will not be called.
defaultReadOnly=
#The default TransactionIsolation state of connections created by this pool.
driverClassName=com.mysql.jdbc.Driver
#UrL
url=jdbc:mysql://192.168.111.15:3306/archive_reader
#User name
username=trafficcast
#Password
password=naitou
#The initial number of connections that are created when the pool is started.
initialSize=10
#The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
maxActive=50
#The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.
maxIdle=20
#The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none.
minIdle=5
#The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely.
maxWait=60000
#The connection properties that will be sent to our JDBC driver when establishing new connections.
connectionProperties=useUnicode=true;characterEncoding=gbk
#The default auto-commit state of connections created by this pool.
defaultAutoCommit=true
#The default read-only state of connections created by this pool. If not set then the setReadOnly method will not be called.
defaultReadOnly=
#The default TransactionIsolation state of connections created by this pool.
defaultTransactionIsolation=READ_UNCOMMITTED
package com.trafficcast.jdbc;import java.io.InputStream;import java.util.Properties;import javax.sql.DataSource;import org.apache.commons.dbcp.BasicDataSourceFactory;public final class JdbcUtils {//Data sourceprivate static DataSource myDataSource = null;//Private Constructorprivate JdbcUtils() {} //Init the properties and init the data source.static {try {Properties prop = new Properties();InputStream is = JdbcUtils.class.getClassLoader().getResourceAsStream("dbcpconfig.properties");prop.load(is);myDataSource = BasicDataSourceFactory.createDataSource(prop);} catch (Exception e) {throw new ExceptionInInitializerError(e);}} /** * Get the data source * @return */public static DataSource getDataSource() {return myDataSource;}}
- DBCP 配置文件加Java code
- java 连接池DBCP 方法二及改进(读配置文件(2种方法))
- 大白菜的java开发学习之旅---c3p0和dbcp的配置文件
- java数据库连接池dbcp
- DataSource Java 官方 DBCP
- Java web----DBCP
- JAVA DBCP 连接池
- Java连接池 DBCP
- java之dbcp笔记
- JDBC连接池(dbcp读取配置文件方式)
- JDBC连接池(dbcp读取配置文件方式)
- spring集成mybatis,dbcp连接池,配置文件
- JNDI配置数据源dbcp方式,配置文件加密
- .properties 配置文件 加空格
- 三层加抽象工厂加反射加配置文件加SqlHelper
- java配置dbcp连接池
- java ee中使用dbcp
- Java使用DBCP连接池
- ORACLE 分区表简介2
- Spring Jdbc Insert 批处理
- Ubuntu下编译libxml2出错
- UIView圆角
- dx命令详解
- DBCP 配置文件加Java code
- poj 1273 Drainage Ditches (网络流_EK_入门)
- CoreData 简介
- iOS常用控件尺寸大集合
- 做一个项目,需要使用单片机控制GSM模块收发短信
- 获取某个字符在字符串中出现的次数
- 云计算论文
- JS判断浏览器类型与版本
- 原创:linux添加scsi硬盘笔记