Reputation: 623
In my Jboss server, datasource is configured as following ( jboss-as-7.1.0.Final\standalone\configuration\standalone.xml).
Is connection pooling enabled here, if so then how many connections and how to track them.
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/env/NVXDataSource" pool-name="NVXDataSource" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/nvx?zeroDateTimeBehavior=convertToNull</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>admin</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
I am looking at defining following properties, where should i do that.
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prepared-statement-cache-size>50</prepared-statement-cache-size>
Thanks.
Upvotes: 4
Views: 42287
Reputation: 17893
These are the property of connection pool. Add the following XML to the <datasource>
element.
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
</pool>
<statement>
<prepared-statement-cache-size>50</prepared-statement-cache-size>
</statement>
Here is an example (from official JBoss documentation. )
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Here is another supporting link.
Upvotes: 4