JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Administration Guide
search filter icon
search icon

Document Information

Preface

1.  Overview of GlassFish Server Administration

Default Settings and Locations

Configuration Tasks

Administration Tools

Instructions for Administering GlassFish 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.  Writing and Running JavaScript Clients to Monitor GlassFish Server

10.  Administering Life Cycle Modules

11.  Extending and Updating GlassFish Server

Part II Resources and Services Administration

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

Configuring Specific JDBC Connection Pool Features

Administering JDBC Resources

To Create a JDBC Resource

To List JDBC Resources

To Update a JDBC Resource

To Delete a JDBC Resource

Enabling the jdbc/__default Resource in a Clustered Environment

To Enable the jdbc/__default Resource for a Clustered Environment

Integrating the JDBC Driver

Supported Database Drivers

Making the JDBC Driver JAR Files Accessible

Automatic Detection of Installed Drivers

Configuration Specifics for JDBC Drivers

IBM DB2 Database Type 2 Driver

IBM DB2 Database Type 4 Driver

Java DB/Derby Type 4 Driver

MySQL Server Database Type 4 Driver

Oracle 10 Database Driver

Oracle 11 Database Driver

PostgreSQL Type 4 Driver

DataDirect Type 4 Driver for IBM DB2 Database

DataDirect Type 4 Driver for IBM Informix

DataDirect Type 4 Driver for Microsoft SQL Server Database

DataDirect Type 4 Driver for MySQL Server Database

DataDirect Type 4 Driver for Oracle 11 Database

DataDirect Type 4 Driver for Sybase Database

Inet Oraxo Driver for Oracle Database

Inet Merlia Driver for Microsoft SQL Server Database

Inet Sybelux Driver for Sybase Database

JConnect Type 4 Driver for Sybase ASE 12.5 Database

13.  Administering EIS Connectivity

14.  Administering Internet Connectivity

15.  Administering the Object Request Broker (ORB)

16.  Administering the JavaMail Service

17.  Administering the Java Message Service (JMS)

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

19.  Administering Transactions

Part III Appendixes

A.  Subcommands for the asadmin Utility

Index

Setting Up the Database

Most applications use relational databases to store, organize, and retrieve data. Applications access relational databases through the Java Database Connectivity (JDBC) API.

The following topics are addressed here:

To Install the Database and Database Driver

  1. Install a supported database product.

    To see the current list of database products supported by GlassFish Server, refer to the Oracle GlassFish Server 3.1-3.1.1 Release Notes.

  2. Install a supported JDBC driver for the database product.

    For a list of drivers supported by GlassFish Server, see Configuration Specifics for JDBC Drivers.

  3. Make the JDBC driver JAR file accessible to the domain administration server (DAS).

    See Integrating the JDBC Driver.

  4. Create the database.

    The application provider usually delivers scripts for creating and populating the database.

Next Steps

You are now ready to create a connection pool for the database, and a JDBC resource that points to the connection pool. See To Create a JDBC Connection Pool and To Create a JDBC Resource. The final step is to integrate the JDBC driver into an administrative domain as described in Integrating the JDBC Driver.

To Start the Database

GlassFish Server includes an implementation of Java DB (formerly known as Derby), however, you can use any JDBC-compliant database. The database is not started automatically when you start GlassFish Server, so if you have applications that require a database, you need to start Java DB manually by using the local start-database subcommand.

Example 12-1 Starting a Database

This example starts Derby on the host host1 and port 5001.

asadmin> start-database --dbhost host1 --dbport 5001 --terse=true
Starting database in the background. 
Log redirected to /opt/SUNWappserver/databases/javadb.log.
Command start-database executed successfully.

See Also

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

To Stop the Database

Use the local stop-database subcommand to stop Java DB on a specified port. A single host can have multiple database server processes running on different ports.

  1. If necessary, notify users that the database is being stopped.
  2. Stop the database by using the stop-database(1) subcommand.

Example 12-2 Stopping a Database

This example stops Java DB on port 5001 of localhost.

asadmin> stop-database --dbhost=localhost --dbport=5001
onnection obtained for host: localhost, port number 5001.
Apache Derby Network Server - 10.2.2.1 - (538595) shutdown 
at 2008-10-17 23:34:2 7.218 GMT
Command stop-database executed successfully.

Troubleshooting

For a laptop that roams between networks, you might have trouble shutting down the database. If you start Java DB and then change your IP address, you will not be able to stop Java DB unless you add a specific --dbhost argument. For example, if you run asadmin start-database --dbhost = 0.0.0.0, and then disconnect Ethernet and switch to wifi, you should run a command similar to the following to stop the database:

asadmin stop-database --dbhost localhost

See Also

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

Java DB Utility Scripts

The Java DB configuration that is available for use with GlassFish Server includes scripts that can help you use Java DB. The following scripts are available in the as-install/javadb/frameworks/NetworkServer/bin directory:

startNetworkServer,startNetworkServer.bat

Script to start the network server

stopNetworkServer,stopNetworkServer.bat

Script to stop the network server

ij,ij.bat

Interactive JDBC scripting tool

dblook,dblook.bat

Script to view all or part of the DDL for a database

sysinfo, sysinfo.bat

Script to display versioning information about the Java DB environment

NetworkServerControl,NetworkServerControl.bat

Script to execute commands on the NetworkServerControl API

To Configure Your Environment to Run Java DB Utility Scripts

  1. Ensure that the JAVA_HOME environment variable specifies the directory where the JDK is installed.
  2. Set the JAVADB_HOME environment variable to point to the as-install/derby directory.

See Also

For more information about these utilities, see the following documentation: