Error: Event Not Found
Issue
While creating the stored procedures in the Install stored procedure binary section of the setup guide, the CREATE PROCEDURE command fails with the following error:
fivetran_get_initial_lri: Event not found
Environment
- Connector: Db2 for LUW
- System: Linux or Unix using bash or zsh
Resolution
Use one of the following alternatives:
Option 1: Use db2 interactive mode
Depending on your DB2 configuration, you may need to add ; at the end of each statement after entering the db2 interactive prompt.
Enter the db2 interactive prompt:
db2Connect to your database:
connect to <database_name> user <username>Create the
fivetran_get_initial_lriprocedure. Replace<install_dir>with the actual directory where the shared library is installed:CREATE OR REPLACE PROCEDURE fivetran_get_initial_lri (OUT lri VARCHAR(100)) LANGUAGE C DYNAMIC RESULT SETS 0 READS SQL DATA NOT DETERMINISTIC EXTERNAL NAME '<install_dir>/libreadlog_store_procs.so!fivetran_get_initial_lri' FENCED NOT THREADSAFE NO EXTERNAL ACTION PROGRAM TYPE SUB NO DBINFO PARAMETER STYLE SQLCreate the
fivetran_get_data_blocksprocedure. Replace<install_dir>with the actual directory where the shared library is installed:CREATE OR REPLACE PROCEDURE fivetran_get_data_blocks (OUT buffer blob, OUT overflow blob, INOUT lri VARCHAR(100), OUT byteswritten INTEGER, OUT version INTEGER) LANGUAGE C DYNAMIC RESULT SETS 0 READS SQL DATA NOT DETERMINISTIC EXTERNAL NAME '<install_dir>/libreadlog_store_procs.so!fivetran_get_data_blocks' FENCED NOT THREADSAFE NO EXTERNAL ACTION PROGRAM TYPE SUB NO DBINFO PARAMETER STYLE SQLCommit the changes:
commitType
quitto exit.
Option 2: Use a SQL script file
Create a SQL script file with the stored procedure definitions. Replace
<install_dir>with the actual directory where the shared library is installed:cat > /tmp/fivetran_create_procedures.sql << 'EOF' CREATE OR REPLACE PROCEDURE fivetran_get_initial_lri (OUT lri VARCHAR(100)) LANGUAGE C DYNAMIC RESULT SETS 0 READS SQL DATA NOT DETERMINISTIC EXTERNAL NAME '<install_dir>/libreadlog_store_procs.so!fivetran_get_initial_lri' FENCED NOT THREADSAFE NO EXTERNAL ACTION PROGRAM TYPE SUB NO DBINFO PARAMETER STYLE SQL; CREATE OR REPLACE PROCEDURE fivetran_get_data_blocks (OUT buffer blob, OUT overflow blob, INOUT lri VARCHAR(100), OUT byteswritten INTEGER, OUT version INTEGER) LANGUAGE C DYNAMIC RESULT SETS 0 READS SQL DATA NOT DETERMINISTIC EXTERNAL NAME '<install_dir>/libreadlog_store_procs.so!fivetran_get_data_blocks' FENCED NOT THREADSAFE NO EXTERNAL ACTION PROGRAM TYPE SUB NO DBINFO PARAMETER STYLE SQL; EOFRun the SQL script file:
db2 -tvf /tmp/fivetran_create_procedures.sqlCommit the changes:
db2 commit(Optional) Clean up the SQL script file:
rm /tmp/fivetran_create_procedures.sql
Verification
After creating the stored procedures using either option, test the newly created procedures as described in the Install stored procedure binary section of the setup guide.
Cause
This issue occurs when the EXTERNAL NAME clause contains a ! character and you run the command in bash inside double quotes. When this happens, bash treats the ! character as a history expanction character and interprets !fivetran_get_initial_lri as a reference to a previous command, resulting in the above error.