Container support
Here are the configurations that currently support DataSource or Resource configuration:
![]() | This page / section has been automatically generated by Cargo's build. Do not edit it directly as it'll be overwritten next time it's generated again. |
Container | Configuration | Resource | DataSource | Transactional DataSource | XA DataSource |
---|---|---|---|---|---|
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
| |||||
|
Notes:
- Datasource support for OW2 JOnAS container has been introduced in Cargo version 1.1.1.
- Datasource support for Glassfish 3.x container has been introduced in Cargo version 1.1.3.
- Datasource support for JBoss container has been introduced in Cargo version 1.2.0.
- JOnAS will handle transactions for datasources using its
jtm
service.
DataSource properties
DataSources are added through pipe-delimited configuration properties that starts with cargo.datasource.datasource
. Example:
cargo.datasource.datasource1=cargo.datasource.url=jdbc:mydriver:userdb\|cargo.datasource.driver=org.database.Driver\|... cargo.datasource.datasource2=cargo.datasource.url=jdbc:mydriver:referencedb\|cargo.datasource.driver=org.database.Driver\|...
Here are the properties that are valid for this:
- Note that c.d means cargo.datasource
- Note that if you specify a property marked do not set you will get a CargoException.
Property | Purpose | Valid Values | DataSource | Transactional DataSource | XA DataSource |
---|---|---|---|---|---|
| the path to this in jndi | any jndi path, like jdbc/userds | mandatory | mandatory | mandatory |
| the implementation class | ex. my.Driver | mandatory: must implement java.sql.Driver | mandatory: must implement java.sql.Driver | mandatory: must implement javax.sql.XADataSource |
| properties to pass to the driver | semi-colon delimited string | optional | optional | mandatory |
| url for the java.sql.Driver | ex. jdbc:host:port/mydb | mandatory | mandatory | optional |
| Determines the type of the driver | defaults to java.sql.Driver, only set if you want to use a javax.sql.XADataSource | do not set | do not set | javax.sql.XADataSource |
| what transaction support | LOCAL_TRANSACTION or XA_TRANSACTION | do not set | mandatory | unset defaults to only valid option: XA_TRANSACTION |
| used in configuration files to reference this datasource | must contain no path-like characters | optional | optional | optional |
| username to connect to the db | string | optional | optional | optional |
| password for the username | string | optional | optional | optional |
Resource properties
Resources are added through pipe-delimited configuration properties that starts with cargo.resource.resource
. Example:
cargo.resource.resource1=cargo.resource.name=resource/apple\|cargo.resource.class=org.mycompany.Apple\|... cargo.resource.resource2=cargo.resource.name=resource/pear\|cargo.resource.driver=org.mycompany.Pear\|...
Here are the properties that are valid for this:
- Note that c.r means cargo.resource
Property | Purpose | Valid Values | Mandatory? |
---|---|---|---|
| the path to this in jndi | any jndi path, like resource/apple | mandatory |
| Interface of the object | valid interface | mandatory |
| the implementation class | valid class implementing the interface | mandatory |
| properties to to populate the class with | semi-colon delimited string; must correspond to setters | optional |
Examples
Users of the Java API can take a look at the following classes as example:
DataSourceOnStandaloneConfigurationTest
: datasource definition.TransactionEmulationDataSourceOnStandaloneConfigurationTest
: datasource definition with transaction emulation.XATransactionDataSourceOnStandaloneConfigurationTest
: XA datasource definition.ResourceOnStandaloneConfigurationTest
: resource definition, showing for examplemailsession
.
Users of the Maven2/Maven3 plugin can use the Maven2 Archetype showing datasource support. Please read: Datasource Definition Archetype.