Skip to content

Log reader stored procedure

The Stelo log reader stored procedure reads the log on the database server instead of through the Db2 ODBC driver on the Stelo VM (see Reading the log over ODBC or with the stored procedure). It works with Db2 for LUW 10.5 and later, on Windows, Linux and AIX database servers. The Capture Agent user also needs CREATE_EXTERNAL_ROUTINE, to create the external C procedures SQ_GET_INITIAL_LRI and SQ_READLOG in its schema; without it, the agent only logs a warning, and the problem shows up later when it reads the log.

  1. Copy the file for the database server's operating system from the StarQuestSP folder of the Stelo Capture installation on Windows (by default C:\Program Files\StarQuest\sqdrplus\StarQuestSP) to the Db2 instance's function directory. If you can't find the folder, ask Stelo Support for the file.

    • Windows: Windows\StarQuestSP.dll to C:\Program Files\IBM\SQLLIB\function. This isn't the directory that usually holds Java stored procedures (ProgramData\IBM\DB2\DB2COPY1\function). The server also needs a recent Microsoft Visual C++ Redistributable for Visual Studio 2015–2022.
    • Linux or AIX: Linux/StarQuestSP or AIX/StarQuestSP to the instance's sqllib/function directory (not the Db2 program directory /opt/ibm/db2/<version>/function). The instance owner must be able to read and run it:

      chmod 755 /home/db2inst1/sqllib/function/StarQuestSP
      
  2. After you add the agent, add the property udbReadLogUsingSP with the value true on its Configuration tab and save. Saving restarts the agent, which registers the procedures SQ_GET_INITIAL_LRI and SQ_READLOG in its control schema (see Users and privileges).

To stop using it, set udbReadLogUsingSP to false, delete the file from the function directory, and drop the procedures (here in the control schema SQDR):

DROP PROCEDURE "SQDR"."SQ_GET_INITIAL_LRI";
DROP PROCEDURE "SQDR"."SQ_READLOG";