TIBCO StreamBase Adapter For Oracle CDC LogMiner Parser and Connection Adapter Sample

This sample demonstrates the use of the Oracle CDC LogMiner Connection and Parser Adapters.

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top menu, click FileLoad StreamBase Sample.

  • Type logm to narrow the list of options.

  • Select Oracle LogMiner Change Data Capture input adapter from the Native Database Connectivity Adapters list.

  • Click OK.

StreamBase Studio creates a project for this sample.

Setting up Oracle LogMiner

  1. Ensure your database is set up correctly and has supplemental logging enabled.

    1. Enable LogMiner:

      1. Log onto your database using a user with DBA privileges.

      2. Check the current log level by executing select log_mode from v$database; If the command returns LOG_MODE of ARCHIVELOG then logging is already enabled and you can skip the following steps. If the command returns NOARCHIVELOG then you must enable logging.

      3. To enable logging, first shut down the database using shutdown immediate;.

      4. Then start up and mount the database using startup mount;.

      5. Now configure the database to enable archive log using alter database archivelog; and alter database open;.

    2. Enabled Supplemental Logging using ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

    3. If you require primary key information, you can enable logging for each table with ALTER TABLE 'schema'.'table name' ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS; or for the entire database ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;

    4. You can also enable full logging for each table with ALTER TABLE 'schema'.'table name' ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS; or for the entire database ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;

    5. Submit the changes using ALTER SYSTEM SWITCH LOGFILE;

  2. This sample provides scripts to create a SAMPLE table and perform insert/update/delete tasks on the table. The adapters in the sample are set up for the SAMPLE table; the Oracle CDC LogMiner Connection adapter properties do need to be updated with the correct database information in order to connect.

    The following scripts are provided:

    1. CreateSampleTable.sql — This SQL script creates the SAMPLE table which the adapters are set up to capture CDC information.

    2. InsertSampleData.sql — This SQL script inserts 10 demo records into the SAMPLE table.

    3. UpdateSampleData.sql — This SQL script updates the 10 demo records in the SAMPLE table with new values.

    4. DeleteSampleData.sql — This SQL script deletes the 10 demo records from the SAMPLE table.

  3. Place the JAR file containing the JDBC driver for your database ojdbc8.jar on the StreamBase classpath. One way to accomplish this is to copy the JAR file to $STREAMBASE_HOME/lib/ext.

Running This Sample in StreamBase Studio

  1. In the Package Explorer, double-click Sample.sbapp to open the sample application.

  2. Select the Connection adapter and open its Properties view.

  3. Open the Connection tab and configure the connection for your database.

  4. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  5. In the Studio's Application Output view, observe tuples emitted on the adapter's Status output ports indicating a connection was made to the database and tables are being monitored.

  6. Using a tool such as Oracle SQL Developer, use the supplied script files to create the SAMPLE table and perform CRUD operations.

  7. In Studio's Application Output view, observe tuples emitted on the TestTableData and AllGenericData output ports indicating changes were made to the SAMPLE table.

  8. When done, press F9 or click the Stop Running Application button.

Sample Location

When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.

Important

Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.

Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:

studio-workspace/sample_change-data-capture-oracle

See Default Installation Directories for the location of studio-workspace on your system.

In the default TIBCO StreamBase installation, this sample's files are initially installed in:

See Default Installation Directories for the default location of studio-workspace on your system.