2.16.2 create-jdbc-resource
Creates a JDBC resource with the specified JNDI name.
Synopsis
asadmin [asadmin-options] create-jdbc-resource [--help] --connectionpoolid connectionpoolid [--enabled={false|true}] [--description description][--target target] jndi_name
Storage location
Application Server installation directory/javaee/glassfish/bin
Function
The create-jdbc-resource subcommand creates a new JDBC resource.
This command is supported in remote mode only.
Precondition
DAS has to be in a running state.
Arguments
- --help | -?
-
Displays the help text for the subcommand.
- --connectionpoolid connectionpoolid
-
Specifies the name of the JDBC connection pool. If two or more JDBC resource elements point to the same connection pool element, they use the same pool connection at runtime.
Type: String
The following values can be specified:
-
Specify connection pool ID
Default value: N/A
-
- --enabled={false|true}
-
Determines whether the JDBC resource is enabled at runtime.
Type: Boolean
The following values can be specified:
-
true
-
false
Default value: true
-
- --description description
-
Specifies the text providing descriptive details about the JDBC resource.
Type: String
The following values can be specified:
-
Provide the description
Default value: N/A
-
- --target target
-
Specifies the target to which an application is deployed.
The resource is always created for the domain as a whole but the resource-ref for the resource is only created for the specified --target. This means that although the resource is defined at the domain level, it is only available at the specified target level. Use the create-resource-ref subcommand to refer to the resource in multiple targets if needed.
Type: String
The following values can be specified:
-
server
Deploys the component to the default server instance. This is the default value.
-
domain
Deploys the component to a domain.
-
cluster_name
Deploys the component to every server instance in the cluster.
-
instance_name
Deploys the component to a particular server instance.
Default value: server
-
- jndi_name
-
Specifies the JNDI name of this JDBC resource.
Type: String
The following values can be specified:
-
Specify the JNDI name
Default value: N/A
-
Examples
The following example creates a jdbc-resource on the server instance instance1.
asadmin create-jdbc-resource --target instance1 --connectionpoolid sample_derby_pool jdbc/DerbyPool
Exit Status
Exit Status |
Explanation |
---|---|
0 |
command executed successfully. |
1 |
error in executing the command. |