JBoss数据源配置参数

Common DataSource parameters

  • <jndi-name> - the JNDI name under which the DataSource should be bound.

  • <use-java-context> - A boolean indicating if the jndi-name should be prefixed with java: which causes the DataSource to only be accessible from within the jboss server vm. The default is true.

  • <user-name> - the user name used when creating the connection (not used when security is configured)

  • <password> - the password used when creating the connection (not used when security is configured)

  • <transaction-isolation> - the default transaction isolation of the connection (unspecified means use the default provided by the database):

    • TRANSACTION_READ_UNCOMMITTED

    • TRANSACTION_READ_COMMITTED

    • TRANSACTION_REPEATABLE_READ

    • TRANSACTION_SERIALIZABLE

    • TRANSACTION_NONE

  • <new-connection-sql> - an sql statement that is executed against each new connection. This can be used to set the connection schema, etc.

  • <check-valid-connection-sql> - an sql statement that is executed before it is checked out from the pool (see <validate-on-match>) to make sure it is still valid. If the sql fails, the connection is closed and new ones created. Also it will be used by <background-validation>

  • <valid-connection-checker-class-name> - a class that can check whether a connection is valid using a vendor specific mechanism

  • <exception-sorter-class-name> - a class that looks at vendor specific messages to determine whether sql errors are fatal and thus the connection should be destroyed.  If none specified, no errors will be treated as fatal.

  • <track-statements> - (a) whether to monitor for unclosed Statements and ResultSets and issue warnings when the user forgets to close them (default nowarn)

  • <prepared-statement-cache-size> - the number of prepared statements per connection to be kept open and reused in subsequent requests. They are stored in aLRU cache. The default is 0 (zero), meaning no cache.

  • <share-prepared-statements> - (b) with prepared statement cache enabled whether two requests in the same transaction should return the same statement (from jboss-4.0.2 - default false).

  • <set-tx-query-timeout> - Whether to enable query timeout based on the length of time remaining until the transaction times out.  This was not ported to 4.0.x until 4.0.3.  Also, it exists in 4.2.x but doesn't function with the JBossTS transaction manager.  JBossTS incorporated this functionality in 5.0.  Default is false.

  • <query-timeout> - A static configuration of the maximum of seconds before a query times out (since 4.0.3).  This value will be overridden appropriately if <set-tx-query-timeout> is true.  The default is "0" (i.e. infinite).

  • <metadata/typemapping> - a pointer to the type mapping in conf/standardjbosscmp.xml (from JBoss4)

  • <validate-on-match> - whether to validate the connection when the JCA layer matches a managed connection (i.e. when the connection is checked out of the pool). With the addition of <background-validation> this is not necessarily required.  Note: Specifying "true" for <validate-on-match> is typically not done in conjunction with specifying "true" for <background-validation> as this would be overkill in most scenarios.  Default is true.

  • <prefill> - whether to attempt to prefill the connection pool to the minimum number of connections. NOTE: only supporting pools (OnePool) support this feature. A warning can be found in the logs if the pool does not support this.  Default is false.

  • <background-validation> - In JBoss 4.0.5 background connection validation was added to help reduce the overall load on the RDBMS system when validating a connection. When using this feature, JBoss will attempt to validate the current connections in the pool is a seperate thread (ConnectionValidator). This must be set to true for <background-validation-minutes> to take effect.  Default is false.

  • <idle-timeout-minutes> - indicates the maximum time a connection may be idle before being closed. Setting to 0 disables it.  Default is 15 minutes.

    (到回收时间时将回收所有空闲的连接,然后再refill到  min-pool-size .不知道能否设置成,回收的时候自动判断只回收超过 min-pool-size的 空闲连接? )

  • <background-validation-minutes> - The interval, in minutes, that the ConnectionValidator will run. Default is 10 minutes. NOTE: It is prudent to set this value to something greater or less than the <idle-timeout-minutes>

  • <background-validation-millis> - This replaces <background-validation-minutes> since JBoss 5.0, <background-validation-minutes> is no longer supported. Also <background-validation>true</background-validation> is redundant, any background-validation-millis > 0 will enable background validation. Seehttps://jira.jboss.org/browse/JBAS-4088.
  • <url-delimiter> - From JBoss5 database failover is part of the main datasource config

  • <url-property> - From JBoss5 database failover is part of the main datasource config

  • <url-selector-strategy-class-name> - From JBoss5 ONLY database failover is part of the main datasource config
  • <stale-connection-checker-class-name> - An implementation of org.jboss.resource.adapter.jdbc.StateConnectionChecker that will decide whether SQLExceptions that notify of bad connections throw org.jboss.resource.adapter.jdbc.StateConnectionException (from JBoss5)
  • <max-pool-size> - the maximum number of connections allowed in the pool.  Default is 20.
  • <min-pool-size> - the minimum number of connections maintained in the pool.  Unless <prefill> is true then the pool will remain empty until first use at which point the pool will be filled to the <min-pool-size>.  When the pool size drops below the <min-pool-size> due to idle timeouts the pool will be refilled to the <min-pool-size>.  Default is 0.
  • <blocking-timeout-millis> - the length of time to wait for a connection to become available when all the connections are checked out.  Default is 30000 (30 seconds).
  • <use-fast-fail> - whether or not to continue to attempt to acquire a connection from the pool even if the nth attempt has failed.  This is to address performance issues where validation SQL takes significant time and resources to execute.  Default is false.

猜你喜欢

转载自ezplus.iteye.com/blog/1627609