Sun GlassFish Enterprise Server v3 Administration Guide

ProcedureTo Create a JDBC Resource

Use the create-jdbc-resource subcommand in remote mode to create a JDBC resource. Creating a JDBC resource is a dynamic event and does not require server restart.

Because all JNDI names are in the java:comp/env subcontext, when specifying the JNDI name of a JDBC resource in the Administration Console, use only the jdbc/name format. For example, a payroll database might be specified as jdbc/payrolldb.

Before You Begin

Before creating a JDBC resource, you must first create a JDBC connection pool. For instructions, see To Create a JDBC Connection Pool.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. Create a JDBC resource by using the create-jdbc-resource(1) subcommand.

    Information about properties for the subcommand is included in this help page.

  3. If necessary, notify users that the new resource has been created.

Example 14–8 Creating a JDBC Resource

This example creates a JDBC resource named DerbyPool.

asadmin> create-jdbc-resource --connectionpoolid DerbyPool jdbc/DerbyPool
Command create-jdbc-resource executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help create-jdbc-resource at the command line.