当前位置: 代码迷 >> J2SE >> proxool怎么配置DataSource
  详细解决方案

proxool怎么配置DataSource

热度:92   发布时间:2016-04-24 16:23:16.0
proxool如何配置DataSource
看到proxool支持DataSource但是不知道怎么配置。


------解决方案--------------------
有多种配置方式,属性文件、xml文件
写个配置文件如:test.properties
jdbc-0.proxool.alias=property-test
jdbc-0.proxool.driver-url=jdbc:oracle:thin:@localhost:1521:chenjh
jdbc-0.proxool.driver-class=oracle.jdbc.driver.OracleDriver
jdbc-0.user=ff
jdbc-0.password=ff
jdbc-0.proxool.maximum-connection-count=10
jdbc-0.proxool.house-keeping-test-sql=select sysdate from dual

代码示例:
PropertyConfigurator.configure( "test.properties ");
Connection conn = null;
conn = DriverManager.getConnection( "proxool.property-test ");
即可得到数据库连接。

------解决方案--------------------
关注
------解决方案--------------------

给大家介绍个技术群

大家一起学习,一起提高

30440614
------解决方案--------------------
我用的是sql2000具体驱动自己改
ConnectionPool-config.xml
-----------------
<?xml version= "1.0 " encoding= "UTF-8 "?>
<proxool>
<alias> SWOKY </alias>
<driver-url>
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=xxx
</driver-url>
<driver-class>
com.microsoft.jdbc.sqlserver.SQLServerDriver
</driver-class>
<driver-properties>
<property name= "user " value= "sa "/>
<property name= "password " value= "zzit070318 "/>
</driver-properties>
<maximum-connection-count> 20 </maximum-connection-count>
<house-keeping-test-sql> select CURRENT_DATE </house-keeping-test-sql>
</proxool>
---------------
再在web.xml里面加上
-----------------
<servlet>
<servlet-name> InitConnectionPool </servlet-name>
<servlet-class> org.logicalcobwebs.proxool.configuration.ServletConfigurator </servlet-class>
<init-param>
<param-name> xmlFile </param-name>
    <!--配置文件的路径自己改--->
<param-value> /WEB-INF/ConnectionPool-config.xml </param-value>
</init-param>
<load-on-startup> 1 </load-on-startup>
</servlet>
-----------------
使用
java.sql.Connection conn =

java.sql.DriverManager.getConnection( "proxool.SWOKY ");
.........
------解决方案--------------------
re 10yue:

Class.forName( "org.logicalcobwebs.proxool.ProxoolDriver ");
conn = DriverManager.getConnection( "proxool.youdatasourcename ");
  相关解决方案