type=page
status=published
title=create-resource-ref
next=create-service.html
prev=create-resource-adapter-config.html
~~~~~~
create-resource-ref
===================

[[create-resource-ref-1]][[GSRFM00055]][[create-resource-ref]]

create-resource-ref
-------------------

creates a reference to a resource

[[sthref519]]

Synopsis

[source,oac_no_warn]
----
asadmin [asadmin-options] create-resource-ref [--help] 
[--target target]
[--enabled={false|true}] reference_name
----

[[sthref520]]

Description

The `create-resource-ref` subcommand creates a reference from a cluster
or an unclustered server instance to a previously created resource, for
example, a JDBC resource created by using the `create-jdbc-resource`
subcommand. This effectively results in the resource being made
available in the JNDI tree of the instance or cluster.

The target instance or instances making up the cluster need not be
running or available for this subcommand to succeed. If one or more
instances are not available, they will receive the new resource the next
time they start.


[NOTE]
=======================================================================

A `resource-ref` can only be created for bindable resources, such as a
`jdbc-resource`, `connector-resource`, `admin-object-resource`,
`mail-resource`, `custom-resource`, or `jndi-resource`.

A `jdbc-connection-pool` or a `connector-connection-pool` are not
referred to directly by applications. Instead, they are referred to
through a `jdbc-resource` or `connector-resource`, respectively.

=======================================================================


This subcommand is supported in remote mode only.

[[sthref521]]

Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--target`::
  Specifies the target for which you are creating the resource
  reference. Valid targets are as follows: +
  `server`;;
    Creates the resource reference for the default server instance. This
    is the default target.
  cluster_name;;
    Creates the resource reference for every server instance in the
    cluster.
  instance_name;;
    Creates the resource reference for the named unclustered server
    instance.
`--enabled`::
  Indicates whether the resource should be enabled. This value will take
  effect only if the resource is enabled at the global level. The
  default is `true`.

[[sthref522]]

Operands

reference_name::
  The name or JNDI name of the resource.

[[sthref523]]

Examples

[[GSRFM520]][[sthref524]]

Example 1   Creating a Reference to a JMS Destination Resource

This example creates a reference to the JMS destination resource
`jms/Topic` on the cluster `Cluster1`.

[source,oac_no_warn]
----
asadmin> create-resource-ref --target Cluster1 jms/Topic
resource-ref jms/Topic created successfully.
Command create-resource-ref executed successfully.
----

[[sthref525]]

Exit Status

0::
  subcommand executed successfully
1::
  error in executing the subcommand

[[sthref526]]

See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:delete-resource-ref.html#delete-resource-ref-1[`delete-resource-ref`(1)],
link:list-resource-refs.html#list-resource-refs-1[`list-resource-refs`(1)]


