A JDBC resource configuration is contained in a <jdbc-resource> element. This element must have a jndi-name attribute, which specifies the JNDI name relative to the java:resource/jdbc namespace where the resource will be bound in the JNDI tree. The JNDI name must be unique between all JDBC resource configurations.

A <jdbc-resource> element may also optionally include a <persistence-instance-ref> element and a <connection-pool> element.

The <persistence-instance-ref> element must have a name attribute, which must be the name of a persistence instance defined elsewhere in the configuration file. The JDBC resource will use the database identified by the referenced persistence instance to execute SQL queries.

The presence of a <connection-pool> element indicates to Rhino that a connection pool should be used to manage the physical connections used by the JDBC resource. The element may define attributes with the names of the connection pool configurable parameters. If a given parameter is absent in the element’s attribute list then the default value for that parameter is assumed.

Example

Below is an example of a JDBC resource:

<jdbc-resource jndi-name="jdbc">
    <persistence-instance-ref name="postgres-jdbc"/>
    <connection-pool
        connection-pool-timeout="5000"
        idle-check-interval="30"
        max-connections="15"
        max-idle-connections="15"
        max-idle-time="600"
        min-connections="0"/>
</jdbc-resource>
Previous page Next page
Rhino Version 2.6.1