Exit Print View

Sun GlassFish Enterprise Server v3 Administration Guide

  This Document Entire Library
Print View

Document Information

Preface

1.  Overview of Enterprise Server Administration

Default Settings and Locations

Configuration Tasks

Administration Tools

Instructions for Administering Enterprise Server

Part I Runtime Administration

2.  General Administration

3.  Administering Domains

4.  Administering the Virtual Machine for the Java Platform

5.  Administering Thread Pools

6.  Administering Web Applications

7.  Administering the Logging Service

8.  Administering the Monitoring Service

9.  Administering Life Cycle Modules

10.  Extending Enterprise Server

Part II Security Administration

11.  Administering System Security

12.  Administering User Security

13.  Administering Message Security

Part III Resources and Services Administration

14.  Administering Database Connectivity

About Database Connectivity

Setting Up the Database

To Install the Database and Database Driver

To Start the Database

To Stop the Database

Java DB Utility Scripts

To Configure Your Environment to Run Java DB Utility Scripts

Configuring Access to the Database

Administering JDBC Connection Pools

To Create a JDBC Connection Pool

To List JDBC Connection Pools

To Contact (Ping) a Connection Pool

To Reset (Flush) a Connection Pool

To Update a JDBC Connection Pool

To Delete a JDBC Connection Pool

Administering JDBC Resources

To Create a JDBC Resource

To List JDBC Resources

To Update a JDBC Resource

To Delete a JDBC Resource

Integrating the JDBC Driver

Configuration Specifics for JDBC Drivers

JDBC Drivers, Full Support

IBM DB2 Database Type 2 Sun GlassFish/DataDirect JDBC Driver

IBM DB2 Database Type 2 JDBC Driver

Java DB/Derby Type 4 JDBC Driver

Microsoft SQL Server Database Type 4 Sun GlassFish/DataDirect JDBC Driver

MySQL Server Database Type 4 Sun GlassFish/DataDirect JDBC Driver

MySQL Server Database Type 4 JDBC Driver

Oracle 11 Database Sun/DataDirect JDBC Driver

Oracle OCI Type 2 Driver for Oracle Databases

Oracle 11 Database Thin Type 4 JDBC Driver

PostgreSQL Type 4 JDBC Driver

Sybase Database Type 4 Sun GlassFish/DataDirect JDBC Driver

JDBC Drivers, Limited Support

IBM Informix Type 4 Driver for Sun/DataDirect

Inet Oraxo JDBC Driver for Oracle Databases

Inet Merlia JDBC Driver for Microsoft SQL Server Databases

Inet Sybelux JDBC Driver for Sybase Databases

JConnect Type 4 Driver for Sybase ASE 12.5 Databases

15.  Administering EIS Connectivity

16.  Administering Internet Connectivity

17.  Administering the Object Request Broker (ORB)

18.  Administering the JavaMail Service

19.  Administering the Java Message Service (JMS)

20.  Administering the Java Naming and Directory Interface (JNDI) Service

21.  Administering Transactions

Part IV Appendixes

A.  Subcommands for the asadmin Utility

Index

Configuring Access to the Database

After establishing the database, you are ready to set up access for Enterprise Server applications. The high-level steps include creating a JDBC connection pool, creating a JDBC resource for the connection pool, and integrating a JDBC driver into an administrative domain. Instructions for performing these steps are contained in the following sections:

Administering JDBC Connection Pools

A JDBC connection pool is a group of reusable connections for a particular database. Because creating each new physical connection is time consuming, Enterprise Server maintains a pool of available connections. When an application requests a connection, it obtains one from the pool. When an application closes a connection, the connection is returned to the pool.

A JDBC resource is created by specifying the connection pool with which the resource is associated. Multiple JDBC resources can specify a single connection pool. The properties of connection pools can vary with different database vendors. Some common properties are the database name (URL), the user name, and the password.

The following tasks and information are used to administer JDBC connection pools:

To Create a JDBC Connection Pool

Use the create-jdbc-connection-pool subcommand in remote mode to register a new JDBC connection pool with the specified JDBC connection pool name. A JDBC connection pool or a connector connection pool can be created with authentication. You can either use a subcommand option to specify user, password, or other connection information using the asadmin utility, or specify the connection information in the XML descriptor file.

One connection pool is needed for each database, possibly more depending on the application. When you are building the connection pool, certain data specific to the JDBC driver and the database vendor is required. You can find some of the following specifics inConfiguration Specifics for JDBC Drivers:

Creating a JDBC connection pool is a dynamic event and does not require server restart. However, there are some parameters that do require server restart. See Configuration Changes That Require Server Restart.

Before You Begin

Before creating the connection pool, you must first install and integrate the database and its associated JDBC driver. For instructions, see Setting Up the Database.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. Create the JDBC connection pool by using the create-jdbc-connection-pool(1) subcommand.

  3. (Optional)

    If needed, restart the server.

    Some parameters require server restart. See Configuration Changes That Require Server Restart.

Creating a JDBC Connection Pool

This example creates a JDBC connection pool named sample_derby_pool on localhost.

asadmin> create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.XADataSource --property portNumber=1527:password=APP:user=APP:serverName= localhost:databaseName=sun-appserv-samples:connectionAttribut es=\;create\\=true sample_derby_pool
Command create-jdbc-connection-pool executed successfully.
See Also

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

To List JDBC Connection Pools

Use the list-jdbc-connection-pools subcommand in remote mode to list all existing JDBC connection pools.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the JDBC connection pools by using the list-jdbc-connection-pools(1) subcommand.

Listing JDBC Connection Pools

This example lists the JDBC connection pools that are on localhost.

asadmin> list-jdbc-connection-pools
sample_derby_pool2
poolA
__TimerPool
DerbyPool
sample_derby_pool
Command list-jdbc-connection-pools executed successfully.
See Also

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

To Contact (Ping) a Connection Pool

Use the ping-connection-pool subcommand in remote mode to test if a connection pool is usable. For example, if you create a new JDBC connection pool for an application that is expected to be deployed later, you can test the JDBC pool with this subcommand before the application is deployed. Running a ping will force the creation of the pool if it hasn't already been created.

Before You Begin

Before you can contact a connection pool, the connection pool must be created with authentication, and the server or database must be running.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. Ping a connection pool by using the ping-connection-pool(1) subcommand.

Contacting a Connection Pool

This example tests to see if the DerbyPool connection pool is usable.

asadmin> ping-connection-pool DerbyPool
Command ping-connection-pool executed successfully
See Also

You can also view the full syntax and options of the subcommand by typing asadmin help ping-connection-pool at the command line.

To Reset (Flush) a Connection Pool

Use the flush-connection-pool in remote mode to reinitialize all connections established in the specified connection pool. The JDBC connection pool or connector connection pool is reset to its initial state. Any existing live connections are destroyed, which means that the transactions associated with these connections are lost. The subcommand then recreates the initial connections for the pool, and restores the pool to its steady pool size.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. Reset a connection pool by using theflush-connection-pool(1) subcommand.

Resetting (Flushing) a Connection Pool

This example resets the JDBC connection pool named __TimerPool to its steady pool size.

asadmin> flush-connection-pool __TimerPool 
Command flush-connection-pool executed successfully.
See Also

You can also view the full syntax and options of the subcommand by typing asadmin help flush-connection-pool at the command line.

To Update a JDBC Connection Pool

You can change all of the settings for an existing pool except its name. Use the get and set subcommands to view and change the values of the JDBC connection pool properties.

  1. List the JDBC connection pools by using the list-jdbc-connection-pools(1) subcommand.

  2. View the attributes of the JDBC connection pool by using the get subcommand.

    For example:

    asadmin get resources.jdbc-connection-pool.DerbyPool.property
  3. Set the attribute of the JDBC connection pool by using the set subcommand.

    For example:

    asadmin set resources.jdbc-connection-pool.DerbyPool.steady-pool-size=9
  4. (Optional)

    If needed, restart the server.

    Some parameters require server restart. See Configuration Changes That Require Server Restart.

To Delete a JDBC Connection Pool

Use the delete-jdbc-connection-pool subcommand in remote mode to delete an existing JDBC connection pool. Deleting a JDBC connection pool is a dynamic event and does not require server restart.

Before You Begin

Before deleting a JDBC connection pool, all associations to the resource must be removed.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the JDBC connection pools by using the list-jdbc-connection-pools(1) subcommand.

  3. If necessary, notify users that the JDBC connection pool is being deleted.

  4. Delete the connection pool by using the delete-jdbc-connection-pool(1) subcommand.

Deleting a JDBC Connection Pool

This example deletes the JDBC connection pool named DerbyPool.

asadmin> delete-jdbc-connection-pool jdbc/DerbyPool
Command delete-jdbc-connection-pool executed successfully.
See Also

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

Administering JDBC Resources

A JDBC resource, also known as a data source, provides an application with a means of connecting to a database. Typically, you create a JDBC resource for each database that is accessed by the applications deployed in a domain. Multiple JDBC resources can be specified for a database.

A JDBC resource is created by specifying the connection pool with which the resource will be associated . Use a unique Java Naming and Directory Interface (JNDI) name to identify the resource. For example, the JNDI name for the resource of a payroll database might be java:comp/env/jdbc/payrolldb.

The following tasks and information are used to administer JDBC resources:

To 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.

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.

To List JDBC Resources

Use the list-jdbc-resources subcommand in remote mode to list the existing JDBC resources.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List JDBC resources by using the list-jdbc-resources(1) subcommand.

Listing JDBC Resources

This example lists JDBC resources for localhost.

asadmin> list-jdbc-resources
jdbc/__TimerPool
jdbc/DerbyPool
jdbc/__default
jdbc1
Command list-jdbc-resources executed successfully.
See Also

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

To Update a JDBC Resource

You can enable or disable a JDBC resource by using the set subcommand. The JDBC resource is identified by its dotted name.

  1. List JDBC resources by using the list-jdbc-resources(1) subcommand.

  2. Modify the values for the specified JDBC resource by using the set(1) subcommand.

    For example:

Updating a JDBC Resource

This example changes the res1 enabled setting to false.

asadmin>set resources.jdbc-resource.res1.enabled=false

To Delete a JDBC Resource

Use the delete-jdbc-resource subcommand in remote mode to delete an existing JDBC resource. Deleting a JDBC resource is a dynamic event and does not require server restart.

Before You Begin

Before deleting a JDBC resource, all associations with this resource must be removed.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List JDBC resources by using the list-jdbc-resources(1) subcommand.

  3. If necessary, notify users that the JDBC resource is being deleted.

  4. Delete a JDBC resource by using the delete-jdbc-resource(1) subcommand.

Deleting a JDBC Resource

This example deletes a JDBC resource named DerbyPool.

asadmin> delete-jdbc-resource jdbc/DerbyPool
Command delete-jdbc-resource executed successfully.
See Also

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

Integrating the JDBC Driver

After setting up the connection pool and resources, integrate the JDBC driver in either of the following ways: