Using the Database Binding Component

Creating a BPEL Module Process Using Prepared Statements

A Prepared Statement represents a SQL statement that has been compiled. Prepared statements can be used to perform insert, update, delete and query operations.

Prepared statements provide the ability to create queries that are more secure, have better performance, and are more convenient to write. They come in two flavors: bound parameter prepared statements, and bound result prepared statements.

Prepared statements allow query templates to be created and then stored on the database server. When a query needs to be made, data to fill in the template is sent to the database server, and a complete query is formed and then executed.

The basic process for creating and using bound parameter prepared statements is simple.

A query template is created and sent to the database server. The database server receives the query template, validates it to ensure that it is well-formed, parses it to ensure that it is meaningful, and stores it in a special buffer. It then returns a special handle that can later be used to reference the prepared statement. When a query needs to be made, data to fill in the template is sent to the database server, and then a complete query is formed and then executed.

This process has some very important behaviors wrapped up in it.

The body of the query is only sent to the database server once. On requests to execute the query, only the data to fill in the template needs to be delivered to the database server. Most of the work required to validate and parse the query only needs to be done a single time, instead of each time that the query is executed. Additionally, for queries that contain a small amount of data, the overhead of sending the query is greatly reduced.

For steps, see the following links:

  1. Creating a WSDL Document For Type : DATABASE

    1. Select Type — Prepared Statement.

      Prepared Statement
    2. Enter a valid Prepared Statement.

    3. Click Discover Parameters to view types for the parameters.

    4. Click Discover Resultset to discover the Resultset types.

      Prepared Statement — Parameters
    5. Click Next.

    6. Enter JNDI Name.

    7. Click Finish.

  2. Creating a WSDL Document For Type SOAP.

  3. Creating a BPEL Process.

  4. Validating BPEL.

  5. Design View : Notifications.

  6. Creating the Composite Application Project.

  7. Deploying and Testing the Composite Application.

For a demo, see http://wiki.open-esb.java.net/Wiki.jsp?page=DatabaseBindingComponentPollScenario.