Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

JDBC Transport Example

This page describes the examples you can run for the Mule Enterprise JDBC transport. These examples are designed to work with Oracle and Sybase databases.

Setup JDBC Example

The Mule Enterprise JDBC Examples are located in your installation at $MULE_HOME/examples/jdbc.

  1. Within $MULE_HOME/examples/jdbc/scripts you will find two directories, one for Oracle and one for Sybase.

  2. Run the tables.ddl script (located in the after-mentioned directory) to create the necessary table in your database.

  3. Run the procs.ddl script located in the after-mentioned directory) to create the necessary stored procedures in your database.

  4. Copy your database driver to your $MULE_HOME/lib/user directory.

  5. Copy the pre-built application archive (mule-example-jdbc.zip) to the application folder ($MULE_HOME/apps).

  6. Start Mule.

  7. Edit the apps/mule-example-jdbc/classes/db.properties file to set up your database connection configuration.
    NOTE: If you needed to change something in db.properties, restart mule or just "touch $MULE_HOME/apps/mule-example-jdbc/mule-config.xml" (in UN*X).

Run the example

To access the web service enter http://localhost:8084/services/jdbc from your browser.

You will see a row of buttons to send commands, a response window and a CSV list of mules to upload.

Insert Data from CSV input

Click "Load CSV data".

You will see an XML output displaying the information on the uploaded mules.

If you try to click the button more than once, you will receive an exception caused by a primary key violation.

Retrieve Count from the DB

Click "Retrieve mules"

You will see an XML output containing the mules stored in the DB table.

Clone Objects

Click "Clone mules".

You will see the number of mules after the cloning process.

Try clicking "Clone mules" again a couple of times and see the number grow.

Verify the growth of the population clicking "Retrieve mules".

Wipe Data from the Database

There is no need to follow this steps in this order.

Click "Cleanup Mules".

You will receive confirmation that the command has been sent.

Verify there are no more mules clicking "Retrieve mules".