JBOSS 下如何配置C3P0的连接池(解决Mysql 8小时的问题)
JBOSS 下如何配置C3P0的连接池(解决Mysql 8小时的问题)问题引起:
在公司配置文档管理系统(OPENKM)时,把数据源切换到Mysql数据源下,经过测试,发现经过8小时后,数据库连接自动断开。
解决办法:
把原来的openkm-ds.xml删除掉。原openkm-ds.xml的内容如下:
<?
xml version="1.0" encoding="UTF-8"
?>
< datasources >
<!-- OpenKM User Activity -->
< local-tx-datasource >
< jndi-name > OKMActivityDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
<!-- <depends>jboss:service=Hypersonic,database=OKMActivity</depends> -->
</ local-tx-datasource >
<!-- OpenKM User Auth -->
< local-tx-datasource >
< jndi-name > OKMAuthDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
<!-- <depends>jboss:service=Hypersonic,database=OKMAuth</depends> -->
</ local-tx-datasource >
<!-- OpenKM Dashboard Stats -->
< local-tx-datasource >
< jndi-name > OKMDashboardStatsDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
<!-- <depends>jboss:service=Hypersonic,database=OKMDashboardStats</depends> -->
</ local-tx-datasource >
<!-- OpenKM Workflow -->
< local-tx-datasource >
< jndi-name > OKMWorkflowDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
</ local-tx-datasource >
</ datasources >
< datasources >
<!-- OpenKM User Activity -->
< local-tx-datasource >
< jndi-name > OKMActivityDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
<!-- <depends>jboss:service=Hypersonic,database=OKMActivity</depends> -->
</ local-tx-datasource >
<!-- OpenKM User Auth -->
< local-tx-datasource >
< jndi-name > OKMAuthDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
<!-- <depends>jboss:service=Hypersonic,database=OKMAuth</depends> -->
</ local-tx-datasource >
<!-- OpenKM Dashboard Stats -->
< local-tx-datasource >
< jndi-name > OKMDashboardStatsDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
<!-- <depends>jboss:service=Hypersonic,database=OKMDashboardStats</depends> -->
</ local-tx-datasource >
<!-- OpenKM Workflow -->
< local-tx-datasource >
< jndi-name > OKMWorkflowDS </ jndi-name >
< connection-url > jdbc:mysql://localhost:3306/openkm </ connection-url >
< driver-class > com.mysql.jdbc.Driver </ driver-class >
< user-name > root </ user-name >
< password > 123456 </ password >
< min-pool-size > 5 </ min-pool-size >
< max-pool-size > 20 </ max-pool-size >
< idle-timeout-minutes > 0 </ idle-timeout-minutes >
< track-statements />
<!-- <security-domain>HsqlDbRealm</security-domain> -->
< prepared-statement-cache-size > 32 </ prepared-statement-cache-size >
< metadata >
< type-mapping > mySQL </ type-mapping >
</ metadata >
</ local-tx-datasource >
</ datasources >
在{JBOSS_HOME}\server\default\deploy目录下新建 c3p0-service.xml 文件;文件内容如下
<?
xml version="1.0" encoding="UTF-8"
?>
<! DOCTYPE server >
< server >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMWorkflowDS" >
< attribute name ="JndiName" > java:OKMWorkflowDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMDashboardStatsDS" >
< attribute name ="JndiName" > java:OKMDashboardStatsDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMAuthDS" >
< attribute name ="JndiName" > java:OKMAuthDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMActivityDS" >
< attribute name ="JndiName" > java:OKMActivityDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
</ server >
<! DOCTYPE server >
< server >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMWorkflowDS" >
< attribute name ="JndiName" > java:OKMWorkflowDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMDashboardStatsDS" >
< attribute name ="JndiName" > java:OKMDashboardStatsDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMAuthDS" >
< attribute name ="JndiName" > java:OKMAuthDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
< mbean code ="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name ="jboss:service=C3P0PooledDataSourceOKMActivityDS" >
< attribute name ="JndiName" > java:OKMActivityDS </ attribute >
< attribute name ="JdbcUrl" > jdbc:mysql://localhost:3306/openkm </ attribute >
< attribute name ="DriverClass" > com.mysql.jdbc.Driver </ attribute >
< attribute name ="User" > root </ attribute >
< attribute name ="Password" > 123456 </ attribute >
<!-- Uncomment and set any of the optional parameters below -->
<!-- See c3p0's docs for more info. -->
< attribute name ="AcquireIncrement" > 2 </ attribute >
< attribute name ="AcquireRetryAttempts" > 30 </ attribute >
<!-- <attribute name="AcquireRetryDelay">1000</attribute> -->
<!-- <attribute name="AutoCommitOnClose">false</attribute> -->
<!-- <attribute name="AutomaticTestTable"></attribute> -->
< attribute name ="BreakAfterAcquireFailure" > true </ attribute >
<!-- <attribute name="CheckoutTimeout">0</attribute> -->
<!-- <attribute name="ConnectionCustomizerClassName"></attribute> -->
<!-- <attribute name="ConnectionTesterClassName"></attribute> -->
<!-- <attribute name="Description">A pooled c3p0 DataSource</attribute> -->
<!-- <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> -->
<!-- <attribute name="FactoryClassLocation"></attribute> -->
<!-- <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> -->
< attribute name ="IdleConnectionTestPeriod" > 40 </ attribute >
< attribute name ="InitialPoolSize" > 2 </ attribute >
<!-- <attribute name="MaxAdministrativeTaskTime">0</attribute> -->
<!-- <attribute name="MaxConnectionAge">0</attribute> -->
< attribute name ="MaxIdleTime" > 1800 </ attribute >
<!-- <attribute name="MaxIdleTimeExcessConnections">0</attribute> -->
< attribute name ="MaxPoolSize" > 15 </ attribute >
< attribute name ="MaxStatements" > 0 </ attribute >
<!-- <attribute name="MaxStatementsPerConnection">0</attribute> -->
< attribute name ="MinPoolSize" > 1 </ attribute >
<!-- <attribute name="NumHelperThreads">3</attribute> -->
<!-- <attribute name="PreferredTestQuery"></attribute> -->
<!-- <attribute name="TestConnectionOnCheckin">false</attribute> -->
< attribute name ="TestConnectionOnCheckout" > false </ attribute >
<!-- <attribute name="UnreturnedConnectionTimeout">0</attribute> -->
<!-- <attribute name="UsesTraditionalReflectiveProxies">false</attribute> -->
< depends > jboss:service=Naming </ depends >
</ mbean >
</ server >
最后一步,把C3P0的JAR c3p0-09.1.11.jar COPY 到{JBOSS_HOME}\server\default\lib 目录下即可。