Domanda

In my OS/400 v6.x system I created an AFTER INSERT trigger for a physical file (DB2 table) using the ADDPFTRG command which is fired correctly everytime I execute a WRITE command on an RPG IV program or make an INSERT statement from the STRSQL but when I execute an INSERT statement from a Java program using JT400(JTOpen) JDBC driver the trigger is not fired.

In both scenarios (From OS400 and from Java) the record is inserted successfully but the trigger is only fired when the record is inserted from the OS400 way.

I've searched on IBM redbooks, JTOpen forums and Google anything that could be related to my case and found nothing at all.

Sadly, since the JT400 jar doesn't have a version number, I can't tell if my version is obsolete and I haven't had the opportunity to try the leatest from JTOpen page.

Is there any technical restriction or library bug that prevents me from firing a DB2 trigger from Java/JT400?

È stato utile?

Soluzione

I solved my problem and will post the solution so anyone else (including my future self) with similar problems can at least get a tip on how to troubleshoot it.

The problem had to do with the libraries added to the JDBC connection user. The trigger was actually being fired but I couldn't notice it because I was expecting it to call an RPG program (say, Program1) after this program was suposed to call another RPG program (say, Program2). I couldn't see the second program being called so that's why I thought my trigger was not being fired from the JDBC INSERT SQL statement.

When I checked the QZDAZOINIT job logs in the WRKACTJOB, I could nottice that my Program2 was not being called because it couldn't have been found in the libraries I configured for the JDBC connection. I only added libraries to be able to see the Phisical data Files (PF) but not the RPG programs (PGM) and inside my trigger program (Program1) I was trying to call another one, so I needed to have the programs library on that JDBC connection user. After I configured all the necesary libraries in the JDBC connection properties, it worked as expected.

Altri suggerimenti

Library list is not the only problem. You may need to care about "Threadsafe" and "Multithreaded job action" parameters of ADDPFTRG command.

ADDPFTRG .... THDSAFE(*YES) MLTTHDACN(*RUN)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top