JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Java CAPS Database Binding Component Tutorial     Java CAPS Documentation
search filter icon
search icon

Document Information

Using the Database Binding Component

Tutorial Plan

Database Binding Component Project in a Nutshell

Starting the GlassFish V2 Application Server

To Start the GlassFish V2 Application Server From NetBeans IDE

Creating a BPEL Module Project For Table Type Operations

To Create a BPEL Module Project

Connecting to a MySQL Database

To Connect to a MySQL Database

Starting the GlassFish Admin Console

To Start the Admin Console

Setting Up Database Access

Integrating a JDBC Driver

To Integrate a JDBC Driver

Creating a JDBC Connection Pool

To Create a JDBC Connection Pool

To Create a JDBC Resource

Creating a WSDL Document For Type : DATABASE

To Create a WSDL Document : dbWSDL

To Select the Database Connection

To Edit the SQL Code

Source View

Creating a WSDL Document For Type SOAP

To Create a WSDL Document : SOAPWSDL

Creating a BPEL Process

To Create a BPEL Process

To Add a Partner Link

To Add a Web Service and Basic Activities

To Edit Web Service : Receive1

To Edit the Web Service : Invoke1

To Edit the Web Service : Reply1

To Edit the Basic Activities : Assign1

To Edit the Basic Activities : Assign2

Validating BPEL

To Invoke Explicit Validation

Design View : Notifications

The Design View

Creating the Composite Application Project

To Create the Composite Application Project

Deploying and Testing the Composite Application

To Deploy the Composite Application

To Test the Composite Application

Debug the Test Case

To Debug the Test Case

Creating a BPEL Module Process Using Prepared Statements

Creating a BPEL Module Project Using Procedures

Creating a BPEL Module Project Using SQL File

Setting Up Database Access

Follow these steps to create and configure a database connection:

  1. Make the driver's JAR file accessible to the domain's server instance. See To Integrate a JDBC Driver.

  2. Create a connection pool for the database. See To Create a JDBC Connection Pool.

  3. Create a JDBC resource that points to the connection pool. See To Create a JDBC Resource.

Integrating a JDBC Driver

A JDBC driver translates an application's JDBC calls into the protocol of the database server.

To Integrate a JDBC Driver

  1. Make the driver accessible to the common class loader.
    1. Copy the driver's JAR and ZIP files into the JavaCAPS_Home\appserver\lib.
    2. Restart the application server.
  2. Make the driver accessible to the system class loader.

Creating a JDBC Connection Pool

When creating the pool with the Admin Console, you are actually defining the aspects of a connection to a specific database. A JDBC connection pool is a group of reusable connections for a particular database. Because creating each new physical connection is time consuming, the server maintains a pool of available connections to increase performance. 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.

Before creating the pool, you must first install and integrate the JDBC driver. See To Integrate a JDBC Driver.

When creating the Create Connection Pools, certain data specific to the JDBC driver and the database vendor must be specified. Before proceeding, gather the following information:

To Create a JDBC Connection Pool

  1. Select the Common Tasks node, then click Resources —> JDBC —> Connection Pool.

    Note - Select New to create a new connection pool from the New Connection Pool page.


  2. Specify the General Settings as follows:
    1. Name: Specify a Name for the pool.
    2. Resource Type: Select a Resource Type from the drop-down menu.

      See the list of choices above.

    3. Database Vendor: Select a vendor from the list provided in the drop-down menu.

    image:New JDBC Connection
  3. Click Next.
  4. Specify the additional General Settings as follows:
    • Datasource Classname: If the JDBC driver has a Datasource class for the resource type and database vendor specified in the previous page, then the value of the Datasource Classname field is provided. An example for MySQL is com.mysql.jdbc.jdbc2.optional.MysqlDataSource.

    • Description: A text description of the connection pool.


    image:New JDBC General
  5. Specify the Pool Settings.

    The values are entered, by default.

  6. Specify the Connection Validation.

    The values are entered, by default.

  7. Specify the Transaction Isolation settings.

    The values are entered, by default.

  8. Add the required properties in the Additional Properties table, such as database name (URL), user name, and password. Enter the following.
    1. databaseName
    2. password
    3. portNumber
    4. serverName
    5. user

    image:New JDBC Additional
  9. Click Finish.

To Create a JDBC Resource

Applications get a database connection from a connection pool by looking up a data source on the Java Naming and Directory Interface (JNDI) tree and then request a connection. The connection pool associated with the datasource provides the connection to the application.

Before You Begin

Before creating a JDBC resource, first create a JDBC connection pool. See To Create a JDBC Connection Pool.

  1. Expand the Resources, then JDBC path node.
  2. Select the JDBC Resources node.
  3. Click New from the JDBC Resources page.
  4. Specify the Resource settings as follows:
    1. JNDI Name: Specify a unique name.

      The JNDI name organizes and locates components within a distributed computing environment similarly to the way that card catalogs organize and represent locations of books in a library. Consequently, the JNDI name becomes an important method of accessing the JDBC resource. By convention, the name begins with the jdbc/string.

      For example: jdbc/payrolldb.


      Note - Remember to give a forward slash.


    2. Pool Name: Choose the connection pool to be associated with the new JDBC resource.
    3. Description: Type a short description of the resource.
    4. Status: If you want the resource to be unavailable, deselect the Enabled checkbox. By default, the resource is available (enabled) as soon as it is created.
  5. Click OK.
    image:New JDBC Resource