Objective
To monitor a table in a database for insert and insert (replicate) the same data into another table in another database.
Prerequisites
- Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS)
- Login to eStudio application
- Understand the basic menus and perspectives (panels) in eStudio application
- Before configuring the database, add the JDBC driver of the database as a resource to the JDBC System lib. Please Refer to the Add Resources to a Service section to perform this.
Scenario
- Insert data into a table in Oracle database through Oracle Application Express.
- Configure a DB component which monitors the table in step 1 for 'insert' query.
- Configure another DB Component to receive data from the previous DB component and in turn insert it into another table in MS SQL Server database.
Components used
Setting up the Example
Insert data into Oracle Database
This section defines inserting data into Oracle DB using Oracle Application Express.
This data will be further monitored as defined in the next section - Configuring DB Component to monitor the data inserted into Oracle Database.
Perform the following actions to insert data in DB:
- Open Oracle Application Express in browser.
- Provide the workspace, username and password details and click Login.
Figure 1: Logging into Oracle Application Express - Navigate to SQL Workshop > ObjectBrowser.
- Select the table into which data is to be inserted. In this case, table EMPLOYEE with columns EMPID, EMPNAME and EMPDEPARTMENT.
- Select Data tab and click Insert Row.
Figure 2: Insert Rows in Oracle DB - Add new row details in EMPLOYEE table and click Create.
Figure 3: Insert data in EMPLOYEE table.
Configuring DB Component to monitor the data inserted into Oracle Database
- Configure a DB component to monitor data that is inserted using Oracle Application Express.
- Add an Event Process with name 'DB_Replication_Eg'. Drag the DB component from DB category in the Service Palette to the Fiorano Orchestrator.
Figure 4: Adding DB component to Fiorano Orchestrator - Rename the DB component from 'DB1' to 'DB_MonitorDataInOracle' to differentiate it from the DB component that will be configured later.
- Double-click the DB component in the Orchestrator to open Configuration Property Sheet (CPS). Click the ellipsis button against Database Conifguration to open DbConfigurations panel.
Figure 5: DB Component CPS - Provide the following details in the DBConfigurations Panel and click OK.
- Database: Oracle (Choose the database to be connected to; 'Oracle' in this example)
- Driver: oracle.jdbc.driver.OracleDriver (Retain the default value)
- URL: jdbc:oracle:thin:@<MachineIP>:xe (machine IP in which the Oracle database is installed and 'xe' is the database name).
- User name: User name to connect to the database.
- Password: Password for the above user name.
- Named Configuration: OracleNamedConfig (Provide any value here to save the database configuration as Named Configuration. 'OracleDBNamedConfig' is the name used in this example).
Figure 6: Database configuration in DbConfigurations Panel
- Click the Test button in Managed Connection Factory panel to see if the database has been configured correctly.
Figure 7: Testing Database configuration in Managed Connection Factory Panel - If the configuration is valid, it gets displayed in Test Connection Configuration pop-up.
Figure 8: Testing Database Configuration - Once the database has been configured properly, click Next in the Managed Connection Factory panel to navigate to Interaction Configurations panel.
Figure 9: Moving to Interaction Configurations Panel - Click SQL Configuration ellipsis button to configure 'Monitor Table' in SQL Configuration Wizard panel.
Figure 10: SQL Configuration in Interaction Configurations Panel - Click the Add button and select Monitor Table option from the menu.
Figure 11: Selecting 'Monitor Table' in SQL Configuration Panel - In SQL Creation Wizard, check Insert under Monitor Table for: and add a table that is to be monitored for Insert operation by clicking the ellipsis button against Monitor Table property.
Figure 12: SQL Creation Wizard - In Table Selection Dialog, click the Fetch Schemas button which fetches all the schemas in the database into Schema drop-down. Select a schema and then click Refresh Tables button to fetch/refresh the table list for the selected schema. Select the table from the list for which Monitoring has to be configured and click OK.
Figure 13: Selecting the table in Table Selection Dialog Panel - In SQL Configuration Wizard, navigate through all the pages by clicking Next and finally click Finish on the last page.
Figure 14: Finishing Monitor Table configuration - An Information dialog box is displayed in which the paths where SQL queries created for above operation are saved. Info: These can be used to delete triggers, stored procedures and copy tables created for monitoring data.
Figure 15: Paths for cleanup SQL - A stored procedure and a nested update query are created which will be used to monitor data. The Adapter Mode automatically changes to 'Scheduler' when a Monitor Table statement is configured. This means that the component will not have an input port and is launched in scheduling mode. Click Finish in SQL Configuration Wizard.
Figure 16: Queries to monitor data in Scheduling mode - Click Finish in Interaction Configurations panel to finish configuring DB_MonitorDataInOracle component.
Figure 17: Finishing 'DB_MonitorDataInOracle' component configuration
Configuring DB Component to replicate data into MS SQL Server 2008 Database
Add another DB component to the Fiorano Orchestrator and rename the component from 'DB1' to 'DB_InsertDataInMSSQL'.
This DB component is used to replicate data from a table in Oracle to a table in MSSQL database.
Configure an Insert Query for table (it is EMPLOYEE in this example) in MSSQL with similar structure as the EMPLOYEE table in Oracle database.
Configuring XSLT Component to transform XML between Oracle and MS SQL DB Instances
Xslt component is used to transform XML between Oracle and MSSQL DB instances which might have subtle differences in schemas.
To configure Xslt component, perform the following actions:
- Drag the Xslt component from Transformation category in the Service Palette to the Fiorano Orchestrator.
- Connect the components in the following manner:
- Output port of DB_MonitorDataInOracle to the input port of Xslt
- Output port of Xslt to the input port of DB_InsertDataInMSSQL.
Figure 18: Connecting Xslt component to the two DB components
- Double-click Xslt1 component in the Orchestrator to open Configuration Property Sheet (CPS). Click the ellipsis button against Mappings to configure mappings.
Figure 19: Configure Mappings - Schemas of the OUT_PORT of DB_MonitorDataInOracle and IN_PORT of DB_InsertDataInMSSQL are displayed. Map them in the following manner, save and close the mappings editor.
Figure 20: Define transformations - Click Finish in the Component Configuration panel to finish Xslt configuration.
Figure 21: Finishing Xslt component configuration
Connecting Display component
Connect the output port of DBInsertDatainMSSQL component to the input port of a Display (present in Util category in Service Palette) component.
Figure 22: Connecting Display to DB_InsertDataInMSSQL
Running the Example
To run the example, perform the following actions in the DB_Replication_Eg Event Process:
- Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
- Click Run Event Process icon (ALT+SHIFT+R) to run the event process. Display1 window gets opened.
- Insert a record into EMPLOYEE table following the steps in Insert Data into Oracle Database section.
- The output message in Display window will have UpdateCount as "1" confirming the successful monitoring and insertion of data.Info: The data inserted in Oracle database is monitored and same record is inserted in MS SQL Server database.
Figure 23: Output message after inserting data in MS SQL Server Database
Reference
Please note that the options used in this example are minimum, which helps you to get an overview of the application. To explore the other options present in the DB, Xslt and Display, refer sections: DB, Xslt and Display respectively.