Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Peter Eakin asked whether an Informix insert trigger could launch a Java class to process a print queue table. keshava.news showed creating a Java UDR with LANGUAGE java and calling it from an INSERT trigger with EXECUTE PROCEDURE. Peter then asked whether Java code outside the database server, not a UDR, could be run; no answer in the thread.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Hi all
Just wondering if it is possible to trigger a java class from informix.
The scenario is that I want to have a print queue table and once a
record is inserted in the table informix should trigger the java class.
This class will use the data in the print queue table and look up other
tables to find information needed to print the document.
Can this be done, if so how?
Peter
You can create procedures/functions in Informix mapping
them to Java classes. See the manual for details on setting
Informix to run java procedures and using them.
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jfoun.doc/jfoun.htmCREATE FUNCTION PrintAction(int a , lvarchar b)
WITH (CLASS="jvp")EXTERNAL NAME 'FirstUDR.Add(java.lang.integer, java.lang.String)'
LANGUAGE java;
CREATE TRIGGER tab1instrig INSERT ON tab1REFERENCING NEW as new
FOR EACH ROW (EXECUTE PROCEDURE PrintAction(new.id, new.info));
Within FOR EACH ROW or AFTER section of INSERT trigger,
simply execute this procedure or function to run the Java code.
cheers,
Keshav.
You can create procedures/functions in Informix mapping
them to Java classes. See the manual for details on setting
Informix to run java procedures and using them.
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jfoun.doc/jfoun.htmCREATE PROCEDURE PrintAction(int a , lvarchar b)
WITH (CLASS="jvp")EXTERNAL NAME 'FirstUDR.Add(java.lang.integer, java.lang.String)'
LANGUAGE java;
CREATE TRIGGER tab1instrig INSERT ON tab1REFERENCING NEW as new
FOR EACH ROW (EXECUTE PROCEDURE PrintAction(new.id, new.info));
Within FOR EACH ROW or AFTER section of INSERT trigger,
simply execute this procedure or function to run the Java code.
cheers,
Keshav.
Thanks for the reply
Is there a way to run a java program which isn't a UDR, i.e. it doesn't
have to be installed in the database server? The code you provided
above is exactly what I need only I want my java code to be located
somewhere else on the same box.
Thanks
Peter
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.