proxool 链接sqlserver的配置
2007-08-09 10:24
204 查看
配置之前必须引入proxool-0.9.0RC1.jar包。
配置 一:xml方法
首先在WEB-INF目录下创建proxool.xml文件,内容如下:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?xml version="1.0" encoding="UTF-8"?>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- the proxool configuration can be embedded within your own application's.
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
Anything outside the "proxool" tag is ignored. -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<something-else-entirely>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<proxool>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<alias>mydata</alias>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<driver-url>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
jdbc:jtds:sqlserver://localhost:1433;DatabaseName=mydatabase
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</driver-url>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<driver-properties>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="user" value="sa" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="password" value="sa" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</driver-properties>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<maximum-connection-count>20</maximum-connection-count>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</proxool>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</something-else-entirely>
alias是别名;
driver-url是驱动的url,就是连接的url;
driver-class是驱动的类,就是数据库驱动;
driver-properties是驱动的属性,可以设置登陆数据库的用户名和密码。
maximum-connection-count是最大连接数。
在工程的web.xml里添加如下内容:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-name>ServletConfigurator</servlet-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
org.logicalcobwebs.proxool.configuration.ServletConfigurator
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</servlet-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
param-name>xmlFile</param-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<param-value>WEB-INF/proxool.xml</param-value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<load-on-startup>1</load-on-startup>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</servlet>
这段标记是要求tomcat在启动的时候加载proxool驱动并且指明 proxool.xml的位置。
配置二:property方法
首先在WEB-INF目录下创建proxool.properties文件,内容如下:
jdbc-0.proxool.alias=mydata jdbc-0.proxool.driver-class=com.microsoft.jdbc.sqlserver.SQLServerDriver
jdbc-0.proxool.driver-url=jdbc:microsoft:sqlserver://localhost:1433;databaseName=mydatabase jdbc-0.user=sa jdbc-0.password=sa jdbc-0.proxool.maximum-connection-count=20
jdbc-0.proxool.prototype-count=4
jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
jdbc-0.proxool.verbose=true
jdbc-0.proxool.statistics=10s,1m,1d
jdbc-0.proxool.statistics-log-level=DEBUG
在工程的web.xml里添加如下内容:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-name>ServletConfigurator</servlet-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<param-name>propertyFile</param-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<param-value>WEB-INF/proxool.properties</param-value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<load-on-startup>1</load-on-startup>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</servlet>
到此proxool的配置就完成了,建立链接时需要如下代码:
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
Connection conn = DriverManager.getConnection("proxool.mydata"); //mydata为alias中的别名
其它配置属性:
maximum-connection-lifetime 最大连接生命周期 默认值:4小时
maximum-active-time: 最大活动时间 默认值:5分钟
maximum-connection-count 最大连接数 默认值:15个
minimum-connection-count 最小连接数 默认值:5个
配置 一:xml方法
首先在WEB-INF目录下创建proxool.xml文件,内容如下:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?xml version="1.0" encoding="UTF-8"?>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!-- the proxool configuration can be embedded within your own application's.
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
Anything outside the "proxool" tag is ignored. -->
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<something-else-entirely>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<proxool>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<alias>mydata</alias>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<driver-url>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
jdbc:jtds:sqlserver://localhost:1433;DatabaseName=mydatabase
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</driver-url>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<driver-properties>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="user" value="sa" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<property name="password" value="sa" />
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</driver-properties>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<maximum-connection-count>20</maximum-connection-count>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</proxool>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</something-else-entirely>
alias是别名;
driver-url是驱动的url,就是连接的url;
driver-class是驱动的类,就是数据库驱动;
driver-properties是驱动的属性,可以设置登陆数据库的用户名和密码。
maximum-connection-count是最大连接数。
在工程的web.xml里添加如下内容:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-name>ServletConfigurator</servlet-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
org.logicalcobwebs.proxool.configuration.ServletConfigurator
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</servlet-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
param-name>xmlFile</param-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<param-value>WEB-INF/proxool.xml</param-value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<load-on-startup>1</load-on-startup>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</servlet>
这段标记是要求tomcat在启动的时候加载proxool驱动并且指明 proxool.xml的位置。
配置二:property方法
首先在WEB-INF目录下创建proxool.properties文件,内容如下:
jdbc-0.proxool.alias=mydata jdbc-0.proxool.driver-class=com.microsoft.jdbc.sqlserver.SQLServerDriver
jdbc-0.proxool.driver-url=jdbc:microsoft:sqlserver://localhost:1433;databaseName=mydatabase jdbc-0.user=sa jdbc-0.password=sa jdbc-0.proxool.maximum-connection-count=20
jdbc-0.proxool.prototype-count=4
jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE
jdbc-0.proxool.verbose=true
jdbc-0.proxool.statistics=10s,1m,1d
jdbc-0.proxool.statistics-log-level=DEBUG
在工程的web.xml里添加如下内容:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-name>ServletConfigurator</servlet-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<param-name>propertyFile</param-name>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<param-value>WEB-INF/proxool.properties</param-value>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</init-param>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<load-on-startup>1</load-on-startup>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</servlet>
到此proxool的配置就完成了,建立链接时需要如下代码:
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
Connection conn = DriverManager.getConnection("proxool.mydata"); //mydata为alias中的别名
其它配置属性:
maximum-connection-lifetime 最大连接生命周期 默认值:4小时
maximum-active-time: 最大活动时间 默认值:5分钟
maximum-connection-count 最大连接数 默认值:15个
minimum-connection-count 最小连接数 默认值:5个
相关文章推荐
- asp.net EFcore配置链接sqlserver
- 【SqlServer】未找到或无法访问服务器.请验证实例名称是否正确并且SQL SERVER已配置允许远程链接
- (绝对有效)sqlserver2000链接proxool连接池,终于配置出spring整合struts,hibernate annotation(pool数据池,sqlserver2000数据库)
- SQLserver 链接服务器 连接ORACLE配置分享
- efcore 配置链接sqlserver
- SqlServer链接服务器配置及其在作业更新时出现 [SQLSTATE 42000](错误 7410)的分析处理
- sqlserver 建立跨IP跨数据库查询配置数据链接
- Centos6.7虚拟机配置Spark1.4.1(安装包链接待整理)
- 基于Oracle和sqlserver的ArcSDE安装配置详解
- Proxool的配置用法
- 记录一个python的configobj读写ini配置文件的链接
- proxool配置
- PLSQL developer +oracle client配置链接远程数据库
- 第十七章——配置SQLServer(2)——32位和64位系统中的内存配置
- iOS 打包上传AppStore相关(3)-iTunes相应配置以及使用蒲公英网站进行应用托管分发(链接/二维码)
- sql server 2005 链接服务器:未将服务器 配置为用于 RPC
- SQLSERVER远程链接Oracle
- Spring+Hibernate的连接池配置(c3p0,proxool)
- sqlserverdriver配置方法 jdbc连接sqlserver
- 史上最详细win7LoadRunner11的安装与配置指南,附安装链接,图文教程