Creating a Control Stream

<< Click to Display Table of Contents >>

Navigation:  Integrating SQLstream Blaze with Other Systems > Appendix A: Legacy Adapters and Agents > Table Reader Adapter >

Creating a Control Stream

Previous pageReturn to chapter overviewNext page

Note: the functionality of this adapter has been replaced by the SQL/MED Plugin for JDBC. If you are new to s-Server, please use this plugin to connect with an external database. This plugin provides SQL/MED access to any foreign DBMS for which a JDBC driver is available.

Creating a Control Stream

You can use a Control Stream to pause/suspend and resume reading from your table, which can be useful when the database is down for maintenance. This stream is optional.

Example Control Stream

The following code exemplifies sets up a control stream.

CREATE OR REPLACE FOREIGN STREAM "TableReaderControl" (

  "SQLS_cmd" VARCHAR(12) NOT NULL, -- e.g. 'pause'/'suspend', 'resume'

  "SQLS_txid" BIGINT,

  "SQLS_reason" VARCHAR(256)

  )

  SERVER "TableReader"

  OPTIONS (TYPE 'control')

  DESCRIPTION 'TableReader control stream';

Example Insert into Control Stream

The following code is an example of inserting into a control stream.

CREATE OR REPLACE PUMP "100-ControlPump" STOPPED

 DESCRIPTION 'pump to stop the action when ROWTIME hits the end of the day' AS

   INSERT INTO "ReportControl" ("SQLS_cmd", "SQLS_reason")

   SELECT STREAM 'suspend', 'suspend report tailing so can perform nightly migration'

   FROM "NewDayView"

   WHERE "new_day";