JDBC resources are identified by a unique name that identifies where in the JNDI tree the JDBC resource will be bound.
This name is relative to the java:resource/jdbc
namespace, for example the JNDI name oracle/db1
will result
in the JDBC resource being bound to the name java:resource/jdbc/oracle/db1
.
The JNDI location is not accessible to SBBs directly.
Each SBB links to the JNDI name in the SBB deployment descriptor.
(For more on SBB deployment descriptor entries please see how SBBs use JDBC to execute SQL.)
|
All JDBC resources required by the SBBs in a service must exist before that service can be activated. A JDBC resource must also have a persistence instance associated with it in order for it to be able to provide database connections to SBBs that request them. |
To create a JDBC resource, use the following rhino-console command or related MBean operation.
Console command: createdatabaseresource
Command |
createdatabaseresource <resource-type> <name> Description Create a database resource. The resource-type parameter must be either 'persistence' or 'jdbc'. Note that when creating JDBC resources the supplied name will automatically be prefixed with 'jdbc/` when determining the internal JNDI name for the resource, so this prefix should not normally be included when specifying the resource name. |
---|---|
Example |
$ ./rhino-console createdatabaseresource jdbc myresource Created JDBC resource myresource |
MBean operation: createJdbcResource
MBean |
|
---|---|
Rhino operation |
public void createJdbcResource(String jndiName) throws NullPointerException, InvalidArgumentException, DuplicateNameException, ConfigurationException; |