Resource elements are as follows:
Contains configured resources, such as database connections.
The following table describes subelements for the RESOURCES element.
Table 2–37 RESOURCES Subelements
Element |
Required |
Description |
---|---|---|
zero or more |
Defines a custom resource. |
|
zero or more |
Defines a resource that resides in an external JNDI (Java Naming and Directory Interface) repository. |
|
zero or more |
Defines a JDBC (Java Database Connectivity) resource. |
|
zero or more |
Defines the properties that are required for creating a JDBC connection pool. |
|
zero or more |
Defines the properties that are required for creating a mail resource. |
none
Defines a custom resource, which specifies a custom server-wide resource object factory. Such object factories implement the javax.naming.spi.ObjectFactory interface.
The following table describes subelements for the CUSTOMRESOURCE element.
Table 2–38 CUSTOMRESOURCE Subelements
Element |
Required |
Description |
---|---|---|
zero or one |
Contains a text description of this element. |
|
zero or more |
Specifies a property or a variable. |
The following table describes attributes for the CUSTOMRESOURCE element.
Table 2–39 CUSTOMRESOURCE Attributes
Attribute |
Default |
Description |
---|---|---|
jndiname |
none |
Specifies the JNDI name for the resource. |
restype |
none |
Specifies the fully qualified type of the resource. |
factoryclass |
none |
Specifies the fully qualified name of the user-written factory class, which implements javax.naming.spi.ObjectFactory. |
enabled |
true |
(optional) Determines whether this resource is enabled at runtime. Legal values are on, off, yes, no, 1, 0, true, false. |
Defines a resource that resides in an external JNDI repository. For example, a generic Java object could be stored in an LDAP server. An external JNDI factory must implement the javax.naming.spi.InitialContextFactory interface.
The following table describes subelements for the EXTERNALJNDIRESOURCE element.
Table 2–40 EXTERNALJNDIRESOURCE Subelements
Element |
Required |
Description |
---|---|---|
zero or one |
Contains a text description of this element. |
|
zero or more |
Specifies a property or a variable. |
The following table describes attributes for the EXTERNALJNDIRESOURCE element.
Table 2–41 EXTERNALJNDIRESOURCE Attributes
Attribute |
Default |
Description |
---|---|---|
jndiname |
none |
Specifies the JNDI name for the resource. |
jndilookupname |
none |
Specifies the JNDI lookup name for the resource. |
restype |
none |
Specifies the fully qualified type of the resource. |
factoryclass |
none |
Specifies the fully qualified name of the factory class, which implements javax.naming.spi.InitialContextFactory. |
enabled |
true |
(optional) Determines whether this resource is enabled at runtime. Legal values are on, off, yes, no, 1, 0, true, false. |
Defines a JDBC (javax.sql.DataSource) resource.
The following table describes subelements for the JDBCRESOURCE element.
Table 2–42 JDBCRESOURCE Subelements
Element |
Required |
Description |
---|---|---|
zero or one |
Contains a text description of this element. |
|
zero or more |
Specifies a property or a variable. |
The following table describes attributes for the JDBCRESOURCE element.
Table 2–43 JDBCRESOURCE Attributes
Attribute |
Default |
Description |
---|---|---|
jndiname |
none |
Specifies the JNDI name for the resource. |
poolname |
none |
Specifies the name of the associated JDBC connection pool, defined in a JDBCCONNECTIONPOOL element. |
enabled |
true |
(optional) Determines whether this resource is enabled at runtime. Legal values are on, off, yes, no, 1, 0, true, false. |
Defines the properties that are required for creating a JDBC connection pool.
The restype attribute of the JDBCCONNECTIONPOOL element is reserved and ignored in Sun Java System Web Server 6.1. Any value set for this attribute is ignored by the server.
The following table describes subelements for the JDBCCONNECTIONPOOL element.
Table 2–44 JDBCCONNECTIONPOOL Subelements
Element |
Required |
Description |
---|---|---|
zero or one |
Contains a text description of this element. |
|
zero or more |
Specifies a property or a variable. |
|
zero or more |
Specifies the connection properties for the connection pool. |
The following table describes attributes for the JDBCCONNECTIONPOOL element.
Table 2–45 JDBCCONNECTIONPOOL Attributes
Attribute |
Default |
Description |
---|---|---|
name |
none |
Specifies the name of the connection pool. A JDBCRESOURCE element's poolname attribute refers to this name. |
datasourceclassname |
none |
Specifies the class name of the associated vendor-supplied data source. This class must implement java.sql.DataSource or java.sql.XADataSource or both. |
steadypoolsize |
8 |
(optional) Specifies the initial and minimum number of connections maintained in the pool. |
maxpoolsize |
32 |
(optional) Specifies the maximum number of connections that can be created to satisfy client requests. |
maxwaittime |
60000 |
(optional) Specifies the amount of time, in milliseconds, that the caller is willing to wait for a connection. If 0, the caller is blocked indefinitely until a resource is available or an error occurs. |
poolresizequantity |
2 |
(optional) Specifies the number of connections to be destroyed if the existing number of connections is above the steady-pool-size (subject to the max-pool-size limit). This is enforced periodically at the idle-time-out-in-seconds interval. An idle connection is one that has not been used for a period of idle-time-out-in-seconds. |
idletimeout |
300 |
(optional) Specifies the maximum time that a connection can remain idle in the pool. After this amount of time, the pool can close this connection. |
transactionisolationlevel |
default JDBC driver isolation level |
(optional) Specifies the transaction isolation level on the pooled database connections. Allowed values are read-uncommitted, read-committed, repeatable-read, or serializable. Applications that change the isolation level on a pooled connection programmatically risk polluting the pool, which can lead to errors. See isolationlevelguaranteed for more details. |
isolationlevelguaranteed |
true |
(optional) Applicable only when transactionisolationlevel is explicitly set. If true, every connection obtained from the pool is guaranteed to have the desired isolation level. This may impact performance on some JDBC drivers. You can set this attribute to false if you are certain that the hosted applications do not return connections with altered isolation levels. |
connectionvalidationrequired |
false |
(optional) Specifies whether connections must be validated before being given to the application. If a resource's validation fails, it is destroyed, and a new resource is created and returned. Legal values are on, off, yes, no, 1, 0, true, false. |
connectionvalidationmethod |
auto-commit |
(optional) Legal values are as follows:
|
validationtablename |
none |
(optional) Specifies the table name to be used to perform a query to validate a connection. This parameter is mandatory if and only if connectionvalidationtype is set to table. |
failallconnections |
false |
(optional) If true, closes all connections in the pool if a single validation check fails. This parameter is mandatory if and only if isconnectionvalidationrequired is set to true. Legal values are on, off, yes, no, 1, 0, true, false. |
Most JDBC 2.0 drivers allow use of standard property lists to specify the user, password, and other resource configuration information. Although properties are optional with respect to Sun Java System Web Server, some properties may be necessary for most databases. For details, see Section 5.3 of the JDBC 2.0 Standard Extension API.
When properties are specified, they are passed to the vendor's data source class (specified by the datasourceclassname attribute) using setName(value) methods.
The following table describes some common properties for the JDBCCONNECTIONPOOL element. The left column lists the property name, and the right column describes what the property does.
Table 2–46 JDBCCONNECTIONPOOL Properties
Property |
Description |
---|---|
user |
Specifies the user name for this connection pool. |
password |
Specifies the password for this connection pool. |
databaseName |
Specifies the database for this connection pool. |
serverName |
Specifies the database server for this connection pool. |
port |
Specifies the port on which the database server listens for requests. |
networkProtocol |
Specifies the communication protocol. |
roleName |
Specifies the initial SQL role name. |
datasourceName |
Specifies an underlying XADataSource, or a ConnectionPoolDataSource if connection pooling is done. |
description |
Specifies a text description. |
url |
Specifies the URL for this connection pool. Although this is not a standard property, it is commonly used. |
Specifies the connection properties for a JDBC connection pool.
The following table describes subelements for the CONNECTIONPROPERTY element.
Table 2–47 CONNECTIONPROPERTY Subelements
Element |
Required |
Description |
---|---|---|
zero or one |
Contains a text description of this element. |
The following table describes attributes for the CONNECTIONPROPERTY element.
Table 2–48 CONNECTIONPROPERTY Attributes
Attribute |
Default |
Description |
---|---|---|
name |
none |
Specifies a name for the connection property. |
value |
none |
Specifies a value for the connection property. |
invocationfrequency |
at-creation |
(optional) Specifies the frequency with which the connection property is invoked. Legal values are at-creation and every-lease. |
Defines a JavaMail (javax.mail.Session) resource.
The following table describes subelements for the MAILRESOURCE element.
Table 2–49 MAILRESOURCE Subelements
Element |
Required |
Description |
---|---|---|
zero or one |
Contains a text description of this element. |
The following table describes attributes for the MAILRESOURCE element.
Table 2–50 MAILRESOURCE Attributes