SAP HANA Output Adapter

Use the SAP HANA Output adapter to send data from Event Stream Processor to an SAP HANA database.

Prerequisites

To run this example, create a table named HANARANDOM in the SAP HANA database. The table should include these columns:
Column Datatype
RANDOMINT INTEGER

Once you have created the table, define an Open Database Connectivity (ODBC) data source that points to your HANA server.

Finally, configure the services.xml file in <ESP_HOME>/bin using the following example as a model for configuration. The DriverLibrary parameter for this example (esp_db_odbc_lib) works only for Windows. Use esp_db_odbc64_lib for all other platforms. Replace the hanadatasource from this example with the data source you specified when you created the ODBC datasource. Also replace the HANA_USER and password from this example with your own unsername and password:
<Service Name="hanaservice" Type="DB">
      <Parameter Name="DriverLibrary">esp_db_odbc_lib</Parameter>
      <Parameter Name="DNS">hanadatasource</Parameter>
      <Parameter Name="User">HANA_USER</Parameter>
      <Parameter Name="Password"encrypted="false">password</Parameter>
</Service>

The table is automatically populated with data from an input adapter named RandomIn.

See the Adapters Guide for more information about how to set up the SAP HANA Output adapter

Example

The example creates a schema named HANARandom, followed by an input stream named Newstream that references HANARandom. Newstream attaches to a RandomIn input adapter. The RandomIn Input adapter provides random data as input to Newstream. Newstream also attaches to an SAP HANA Output adapter which uses the data provided by RandomIn to populate the database you set up as a prerequisite. The CCL code for this example is:

CREATE SCHEMA HANARANDOM (RANDOMINT integer);
CREATE INPUT STREAM NEWSTREAM SCHEMA HANARANDOM;
ATTACH INPUT ADAPTER RandomIn TYPE randomtuplegen_in TO NEWSTREAM PROPERTIES RowCount=10;
ATTACH OUTPUT ADAPTER HANAOut TYPE hana_out TO NEWSTREAM PROPERTIES service='hanaservice', table='HANARANDOM';