Skip to content

Defined type jboss::datasource

Krzysztof Suszyński edited this page Oct 15, 2015 · 2 revisions

The jboss::datasource defined type

This defined type can be used to add and remove JBoss data sources. It support both XA and Non-XA data sources. It can setup data sources and manage required drivers.

# Non-XA data source
jboss::datasource { 'test-datasource':
  ensure     => 'present',
  username   => 'test-username',
  password   => 'test-password',
  jdbcscheme => 'h2:mem',
  dbname     => 'testing;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE',
  host       => '',
  port       => '',
  driver     => {
    'name'       => 'h2',
  }
}
# XA data source
jboss::datasource { 'test-xa-datasource':
  ensure     => 'present',
  xa         => true,
  username   => 'test-username',
  password   => 'test-password',
  jdbcscheme => 'h2:mem',
  dbname     => 'testing-xa;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE',
  host       => '',
  port       => '',
  driver     => {
    'name'                            => 'h2',
    'driver-xa-datasource-class-name' => 'org.h2.jdbcx.JdbcDataSource'
  }
}

Parameters for jboss::datasource:

This type uses JBoss module standard metaparameters

jdbcscheme parameter

Required parameter. This is the JDBC scheme for ex.: postgresql, oracle, mysql, mssql or h2:mem. All accepted by JBoss JDBC shemes are valid.

host parameter

Required parameter. This is the name of the database host or it's IP address. Pass empty string '' if host isn't needed.

port parameter

Required parameter. This is the port of the database. Pass empty string '' if port isn't needed.

username parameter

Required parameter. This is the user name that will be used to connect to database.

password parameter

Required parameter. This is the password that will be used to connect to database.

dbname parameter

This is the namevar. Name of the database to be used.

ensure parameter

Standard ensure parameter. Can be either present or absent.

jndiname parameter

Java JNDI name of the datasource. Be default it is equals to java:jboss/datasources/<name>

xa parameter

This parameters indicate that given data source should XA or Non-XA type. Be default this is equal to false

jta parameter

This parameters indicate that given data source should support Java JTA transactions. Be default this is equal to true

minpoolsize parameter

Minimum connections in connection pool. By default it is equal to 1.

maxpoolsize parameter

Maximum connections in connection pool. By default it is equal to 50.

enabled parameter

This parameter control whether given data source should be enabled or not. By default it is equal to true.

options parameter

This is an extra options hash. You can give any additional options that will be passed directly to JBoss data source. Any supported by JBoss values will be accepted and enforced. Values that are not mentioned are not processed.

Default options added to every data source (they can be overwritten):

  • validate-on-match => false
  • background-validation => false
  • share-prepared-statements => false
  • prepared-statements-cache-size => 0

Default options added to every XA data source (they can be overwritten):

  • same-rm-override => true
  • wrap-xa-resource => true