
<jdbc>
<jndi-name>ExternalDataSource</jndi-name>
<datasource-class>org.postgresql.jdbc2.optional.SimpleDataSource</datasource-class>
<parameter>
<param-name>serverName</param-name>
<param-type>java.lang.String</param-type>
<param-value>dbhost</param-value>
</parameter>
<parameter>
<param-name>databaseName</param-name>
<param-type>java.lang.String</param-type>
<param-value>db1</param-value>
</parameter>
<parameter>
<param-name>user</param-name>
<param-type>java.lang.String</param-type>
<param-value>slee</param-value>
</parameter>
<parameter>
<param-name>password</param-name>
<param-type>java.lang.String</param-type>
<param-value>changeme</param-value>
</parameter>
<connection-pool>
<max-connections>15</max-connections>
<idle-check-interval>0.0</idle-check-interval>
</connection-pool>
</jdbc>
19.4 SBB use of JDBC
A SBB is able to use JDBC to execute SQL statements. The SBB must declare its intent to use JDBC in an extension deployment
descriptor.
For more information regarding extension deployment descriptors please refer to Chapter 18.
This deployment descriptor is the
oc-sbb-jar.xml
file that is contained in the
META-INF
directory in the SBB jar file. The
JDBC DataSource is defined in the <
resource-ref
> element of the
oc-sbb-jar.xml
file. This <
resource-ref
> element
is as follows:
<resource-ref>
<!-- Name of resource under sbb s java:comp/env tree -->
<res-ref-name>foo/datasource</res-ref-name>
<!-- Resource type - must be javax.sql.DataSource -->
<res-type>javax.sql.DataSource</res-type>
<!-- Only Container auth supported -->
<res-auth>Container</res-auth>
<!-- Only Shareable scope supported -->
<res-sharing-scope>Shareable</res-sharing-scope>
<!-- Location of resource in Rhino’s java:resource tree.
res-ref-name is linked to this location -->
<res-jndi-name>jdbc/ExternalDataSource</res-jndi-name>
</resource-ref>
The <
resource-ref
> element must be placed inside the <
sbb
> element of the
oc-sbb-jar.xml
file. Please note in the
above example that the <
res-jndi-name
> element has the value
jdbc/ExternalDataSource
and that this value maps to the
earlier database configuration example.
Open Cloud Rhino 1.4.3 Administration Manual v1.1 115
Comentários a estes Manuais