RDBMS Event Generator
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Before you can create RDBMS events and define channel rules for your new events, you must create a data source that points to the database and hence the Table on which the channel rule (Event) will be defined. For more information on defining channel rules for RDBMS Event Generators, see "Defining Channel Rules for a RDBMS Event Generator" in Managing WebLogic Integration Solutions Guide.
After you create your data source, you must also create the message broker channels that the RDBMS event publishes to, before you can define channel rules for any RDBMS events.
The following sections detail how you create a data source and message broker channels:
Before you create a data source, you must be aware of the database connection parameters for the data source you want to connect to. If you are unaware of the database connection parameters, contact your system administrator.
The steps involved in creating a data source are:
The first step in creating a data source is adding the required driver to the WebLogic classpath.
@REM SET THE CLASSPATH
set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH...
set CLASSPATH=%WL_HOME%\server\lib\driver.jar;%CLASSPATH%
Note: Before you use a MS SQL XA driver to create events, you must follow the steps detailed in "Installing Stored Procedures for JTA" in The MS SQL Service Driver.
The next step in creating a data source is creating the connection that you will use to connect to the data source.
For a list of the supported databases, see Supported Databases.
Note: WebLogic Server JDBC certified drivers are marked with *.
The Define Connection Properties page is displayed, as shown in the following figure.
The fields that appear on this page depend on the database and driver selected on the previous page.
Note: If you want to configure a trigger type event, it is recommended that the database account user name you enter in the Database User Name field is the same as the schema name of the table on which you want to configure the trigger type event. The account name you use must also have permission to CREATE/DROP tables and triggers. If you are configuring an Oracle database, the account name you use must also have permission to CREATE/DROP tables, triggers, and sequences.
The Test Database Connection page is displayed, as shown in the following figure.
The fields that appear on this page depend on the database and driver selected on the previous page.
It is recommended that you test the driver configuration before proceeding to the next step. If you do not test the driver configuration and you have made an error in the previous steps, you will not be able to connect to the required database when you try to configure your RDBMS Event Generator.
An error message will appear at the top of the page if there is a problem with your connection settings.
When your configuration passes the test, the Create and Deploy page is displayed, as shown in the following figure.
The next step is defining the connection pool configuration for your data source.
The final step in creating your data source connection is creating a new data source.
Before you can create your RDBMS Event Generators in the WebLogic Integration Administration Console and define channel rules for these new event generators, you must create the message broker channels to which your new event generators will publish.
You should consider the following:
DetabaseMetadata.getUserName()
as the schema name to create database artifacts for Tables, Triggers, and Sequences (Oracle only).StringIndexOutOfBoundsException
. For example, the exception will occur if there are 2 tables with the same name in different schemas, like MASAA01.prod
and dbo.prod
in the same Catalog with the login name MASAA01, and the user creates an event on dbo.prod
.The exception will occur in this case, since a MS SQL Stored procedure called 'sp_columns' is used to retrieve the columns in the Table and their data types. The stored procedure takes only the Table name and not the fully qualified Table name. So it always returns the columns from MASAA01.prod
instead of the dbo.prod
columns, even though the dbo.prod
columns should be received.
dbo
schema.
This section describes how you create the message broker channels that your RDBMS Event Generator will publish to. You need to create three different types of message broker channel:
<?xml version="1.0"?>
<!--
A sample channel file
Change "channelPrefix" and <channel/> elements to customize
The following namespaces are used in this sample file. These
namespaces refer to schemas that must be present in a schema
directory.
- xmlns:eg=http://www.bea.com/wli/eventGenerator" is used
for event generator metadata references
- xmlns:dp="http://www.bea.com/wli/control/dynamicProperties" is
used by the file event generator to pass payload for pass-by-filename
- xmlns:oagpo="http://www.openapplications.org/003_process_po_007" is used for a sample payload description
-->
<channels xmlns="http://www.bea.com/wli/broker/channelfile"
channelPrefix="/SamplePrefix"
xmlns:eg="http://www.bea.com/wli/eventGenerator"
xmlns:dp="http://www.bea.com/wli/control/dynamicProperties"
xmlns:oagpo="http://www.openapplications.org/003_process_po_007">
<channel name ="Samples" messageType="none">
<!-- A simple channel passing XML -->
<channel name ="SampleXmlChannel" messageType="xml"/>
<!-- A simple channel passing rawData -->
<channel name ="SampleRawDataChannel" messageType="rawData"/>
<!-- A simple channel passing a string -->
<channel name ="SampleStringChannel" messageType="string"/>
</channel>
</channels>
System.out
message:System.out.printIn(System.currentTimeMillis()+"-"+x0);
For the XML Channel, there is a type-safe way of retrieving the XML contents:
import com.bea.wli.rdbmsEG.testFirst.TableRowSetDocument;
import com.bea.wli.rdbmsEG.testFirst.TableRowSetDocument.TableRowSet;
import com.bea.wli.rdbmsEG.testFirst.TableRowSetDocument.TableRowSet.TableRow;
....
public void subscription(com.bea.xml.XmlObject x0)
{
//#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// input transform
// parameter assignment
//#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
final TableRowSetDocument doc = TableRowSetDocument.Factory.newInstance();
doc.set(x0);
System.out.println("The document: " + doc);
final TableRowSet rowSet = doc.getTableRowSet();
final TableRow[] rows = rowSet.getTableRowArray();
for(int i = 0; i < rows.length; i++)
{
System.out.println("---" + (i + 1) + "---");
System.out.println("CHAR1: " + rows[i].getCHAR1());
System.out.println("DATE1: " + rows[i].getDATE1());
}
}
For a RawData Channel, the code snippet below illustrates how it can be used to retrieve data published by the RDBMS Event Generator:
import com.bea.data.RawData;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import weblogic.jdbc.rowset.WLCachedRowSet;
.
public void subscription(com.bea.data.RawData x0)
{
//#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// input transform
// parameter assignment
//#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
try
{
ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(rawData.byteValue());
ObjectInputStream objectInputStream = new ObjectInputStream(arrayInputStream);
WLCachedRowSet rowSet = (WLCachedRowSet) objectInputStream.readObject();
System.out.println("-- Event --\r\n");
rowSet.moveToCurrentRow();
while (rowSet.next())
{
Map map = rowSet.getCurrentRow();
for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();)
{
Object key = iterator.next();
System.out.println(" Column: " + key + ", Value: " + map.get(key));
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
For more information on message broker channels, see How do I: Create Message Broker Channels? in Publishing and Subscribing to Channels in the WebLogic Workshop Help.
The Message Broker module in the WebLogic Integration Administration Console allows you to monitor and manage all the Message Broker channels in your application. To learn more, see Message Broker in Managing WebLogic Integration Solutions.
Once you have created your data source and message broker channels, you can create RDBMS Event Generators and define channel rules for these generators in the WebLogic Integration Administration Console.
For information on creating RDBMS Event Generators and defining channel rules for these generators, see Event Generators in Managing WebLogic Integration Solutions.
![]() ![]() |
![]() |
![]() |