This API documentation is for Ballerina 1.2.0. View API documentation for the latest release.

Record - java.jdbc : PoolOptions

Represents the properties which are used to configure DB connection pool. Default values of the fields can be set through the configuration API.

Closed record

Fields

  • connectionInitSql string (default config:getAsString(b7a.jdbc.pool.connectionInitSql, ))
  • SQL statement that will be executed after every new connection creation before adding it to the pool. Default value is none and it can be changed through the configuration API with the key b7a.jdbc.pool.connectionInitSql.

  • dataSourceClassName string (default config:getAsString(b7a.jdbc.pool.dataSourceClassName, ))
  • Name of the DataSource class provided by the JDBC driver. This is used on following scenarios. 1. In JDBC client when DB specific properties are required (which are given with dbOptions) 2. In any data client in which XA transactions enabled by isXA property and need to provide a custom XA implementation.Default value is none and it can be changed through the configuration API with the key b7a.jdbc.pool.dataSourceClassName.

  • autoCommit boolean (default config:getAsBoolean(b7a.jdbc.pool.autoCommit, true))
  • Auto-commit behavior of connections returned from the pool. Default value is true and it can be changed through the configuration API with the key b7a.jdbc.pool.autoCommit.

  • isXA boolean (default config:getAsBoolean(b7a.jdbc.pool.isXA, false))
  • Whether connections are used for a distributed transaction. Default value is false and it can be set through the configuration API with the key b7a.jdbc.pool.isXA.

  • maximumPoolSize int (default config:getAsInt("b7a.jdbc.pool.maximumPoolSize", 15))
  • The maximum size that the pool is allowed to reach, including both idle and in-use connections. Default value is 15 and it can be changed through the configuration API with the key b7a.jdbc.pool.maximumPoolSize.

  • connectionTimeoutInMillis int (default config:getAsInt("b7a.jdbc.pool.connectionTimeoutInMillis", 30000))
  • The maximum number of milliseconds that a client will wait for a connection from the pool. Default value is 30000 (30 seconds) and it can be changed through the configuration API with the key b7a.jdbc.pool.connectionTimeoutInMillis. Lowest acceptable connection timeout value is 250 ms.

  • idleTimeoutInMillis int (default config:getAsInt(b7a.jdbc.pool.idleTimeoutInMillis, 600000))
  • The maximum amount of time that a connection is allowed to sit idle in the pool. Default value is 600000 (10 minutes) and it can be changed through the configuration API with the key b7a.jdbc.pool.idleTimeoutInMillis. The minimum allowed value is 10000ms (10 seconds). This setting only applies when minimumIdle is defined to be less than maximumPoolSize.

  • minimumIdle int (default config:getAsInt(b7a.jdbc.pool.minimumIdle, 15))
  • The minimum number of idle connections that pool tries to maintain in the pool. Default is the same as maximumPoolSize and it can be changed through the configuration API with the key b7a.jdbc.pool.minimumIdle.

  • maxLifetimeInMillis int (default config:getAsInt(b7a.jdbc.pool.maxLifetimeInMillis, 1800000))
  • The maximum lifetime of a connection in the pool. Default value is 1800000 (30 minutes) and it can be changed through the configuration API with the key b7a.jdbc.pool.maxLifetimeInMillis. A value of 0 indicates unlimited maximum lifetime (infinite lifetime), subject to the idleTimeoutInMillis.

  • validationTimeoutInMillis int (default config:getAsInt("b7a.jdbc.pool.validationTimeoutInMillis", 5000))
  • The maximum duration of time that a connection will be tested for aliveness. Default value is 5000 (5 seconds) and it can be changed through the configuration API with the key b7a.jdbc.pool.validationTimeoutInMillis. Lowest acceptable validation timeout is 250 ms.