[color=green][b]
近段时间系统偶尔出现cannot open connection 问题,我们的用的是hibernate调JBOSS连接池方式。[/b][/color]
[color=red][b]有谁知道JBOSS连接池默认连接数是多少?在哪个配置文件有这个默认的连接数?它连接方式是什么?DBCP?[/b][/color]
如果你用的是是4.x的Jboss的话,请参考:docs/dtd/jboss-ds_1_0.dtd,相信你很容易就能找到控制最大/最小连接数的选项,应该是诸如:max-pool-size/min-pool-size 之类的;
另外,你还可在 docs/example/jca 目录下找到针对各种数据库的数据源配置示例,用来参考 参考。
关于默认连接数,我还真不知道,估计你要查看文档寻找了,或者你可以直接访问管理控制台:http://host:8080/jmx-console/,找到数据源项,应该可以看到当前的最大连接数的。
DBCP 是Apache组织提供的一个开源 数据库连接池 实现,通常和Tomcat一起使用,在JBoss中并不使用该实现,因为JBoss有自己的连接池实现.
连接方式当然是基于jdbc协议的socket了,我不明白你指的是否是这个意思?
我用c3p0,jdk1.5,jboss4.2
%jboss4%\server\default\deploy下增加c3p0-service.xml
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
name="jboss:service=C3P0PooledDataSource">
<attribute name="JndiName">java:jdbc/test</attribute>
<attribute name="JdbcUrl">
jdbc:mysql://localhost:3306/test?autoReconnect=true
</attribute>
<attribute name="DriverClass">com.mysql.jdbc.Driver</attribute>
<attribute name="User">root</attribute>
<attribute name="Password">root</attribute>
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
<attribute name="AcquireIncrement">5</attribute>
<!-- <attribute name="AcquireRetryAttempts">30</attribute> -->
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
<!-- <attribute name="BreakAfterAcquireFailure">false</attribute> -->
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionTesterClassName">0</attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">true</attribute> -->
<!-- <attribute name="IdleConnectionTestPeriod">-1</attribute> -->
<!-- <attribute name="InitialPoolSize">3</attribute> -->
<!-- <attribute name="MaxIdleTime">0</attribute> -->
<attribute name="MaxPoolSize">50</attribute>
<attribute name="MaxStatements">0</attribute>
<attribute name="MaxStatementsPerConnection">100</attribute>
<attribute name="MinPoolSize">5</attribute>
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
<!-- <attribute name="TestConnectionOnCheckout">false</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
<depends>jboss:service=Naming</depends>
[/code]
其他具体可以站内消息联系