Data Cartridge Name Understanding the Oracle CEP JDBC Data Cartridge

17-4 Oracle Complex Event Processing CQL Language Reference ?xml version=1.0 encoding=UTF-8? jdbcctxconfig:config xmlns:jdbcctxconfig=http:www.bea.comnswlevsconfigapplication xmlns:jc=http:www.oracle.comnsocepconfigjdbc 2. The JDBC cartridge context configuration is done under the parent level tag jdbc-ctx. A context defines one or more functions, each of which is associated with a single SQL query. The configuration also specifies the data source representing the database against which the SQL queries are to be executed. Each function can have input parameters that are used to pass arguments to the SQL query defining the function, and each function specifies the return-component-type. Since the call to this function is always enclosed within a TABLE clause, the function always returns a Collection type. The return-component-type property indicates the type of the component of that collection. The value of the name property must match the value used for the id attribute in the EPN file, as shown in Example 17–3 . Example 17–4 shows how to reference the jdbc:jbdc-context in an Oracle CQL query. In this case, the query uses link name JdbcCartridgeOne defined in Example 17–3 to propagate this application context to the Oracle CEP JDBC data cartridge. The Oracle CQL query in Example 17–4 invokes the function getDetailsByOrderIdName associated with Oracle CEP JDBC data cartridge application context JdbcCartridgeOne. Example 17–4 jc:jdbc-ctx Element in Component Configuration File ... jc:jdbc-ctx nameJdbcCartridgeOnename data-sourceStockDSdata-source function name=getDetailsByOrderIdName param name=inpOrderId type=int param name=inpName type=char return-component-type com.oracle.cep.example.jdbc_cartridge.RetEvent return-component-type sql[CDATA[ SELECT Employee.empName as employeeName, Employee.empEmail as employeeEmail, OrderDetails.description as description FROM PlacedOrders, OrderDetails , Employee WHERE PlacedOrders.empId = Employee.empId AND PlacedOrders.orderId = OrderDetails.orderId AND Employee.empName = :inpName AND PlacedOrders.orderId = :inpOrderId ]]sql function jc:jdbc-ctx ... processor nameProcname rules query id=q1[CDATA[ RStream select currentOrder.orderId, details.orderInfo.employeeName, details.orderInfo.employeeemail, Oracle CEP JDBC Data Cartridge 17-5 details.orderInfo.description from OrderArrival[now] as currentOrder, TABLEgetDetailsByOrderIdNameJdbcCartridgeOne currentOrder.orderId, currentOrder.empName as orderInfo as details ]]query rules processor ... For more information, see How to Configure Oracle CEP JDBC Data Cartridge Application Context in the Oracle Complex Event Processing Developers Guide for Eclipse.

17.2 Using the Oracle CEP JDBC Data Cartridge

In general, you use the Oracle CEP JDBC data cartridge as follows: 1. Define the data sources in the Oracle CEP server config.xml file that are referenced by the Oracle CEP JDBC data cartridge contexts. The name used for a data source during its configuration in Oracle CEP server config.xml is used while configuring the JDBC cartridge context, using the data-source property, as shown in Example 17–4 . To use the Oracle JDBC version 11.2 driver bundled with Oracle CEP, in the Oracle CEP server config.xml file, create a data-source element for your driver version and add a driver-params child element as Example 17–5 shows. Example 17–5 driver-params Child Element driver-params urljdbc:oracle:thin:lcw2k18:1531:lcw101url driver-nameoracle.jdbc.xa.client.OracleXADataSourcedriver-name properties elementnameusernamevaluescottvalueelement elementnamepasswordnamevalue{3DES}EoIfSBMhnW8=valueelement elementnamecom.bea.core.datasource.serviceNamenamevalueoracle11.2gvalueelement elementnamecom.bea.core.datasource.serviceVersionnamevalue11.2.0valueelement elementnamecom.bea.core.datasource.serviceObjectClassnamevaluejava.sql.Drivervalueelement properties use-xa-data-source-interfacetrueuse-xa-data-source-interface driver-params For more information, see: ■ Configuring JDBC for Oracle CEP in the Oracle Complex Event Processing Administrators Guide ■ Configuring Access to a Different Database Driver or Driver Version in the Oracle Complex Event Processing Administrators Guide 2. Declare and define an Oracle CEP JDBC cartridge application-scoped context. For more information, see Section 17.1.4, Oracle CEP JDBC Data Cartridge Application Context . Note: To use the Oracle CEP JDBC data cartridge, your data source must use Oracle JDBC driver version 11.2 or higher.