Calling a java function from a trigger

2019-09-12 Thread fkalim
Hi, I'm looking for a clear example on how to call a java function from a trigger based on an inserted row. Any help would be appreciated. I have attached what I have so far. Currently, the error I get is on the the last line of the trigger: org.jooq.exception.DataAccessException: SQL [CREATE

Re: Calling a java function from a trigger

2019-09-12 Thread Rick Hillegas
Your sample program needs some tweaking: 1) The CREATE TRIGGER statement needs a REFERENCING clause in order to bind a new row transition variable. That is why you are getting the error 'Column name 'TEST' appears in a statement without a FROM list' 2) After that, you will run into a further

Re: Calling a java function from a trigger

2019-09-12 Thread Rick Hillegas
You don't need the schema name in the EXTERNAL NAME clause. The INSTALL_JAR and SYSCS_SET_DATABASE_PROPERTY calls wire together a custom classpath for your database. All of the classes in the installed jar files will appear to your database session as though they are on your classpath. So you

Re: Calling a java function from a trigger

2019-09-12 Thread fkalim
Thanks Rick! This is really helpful. How would I let derby know where the compiled classes are placed? In fact, if I am creating the connection to the database in Java, and also creating the tables and triggers programmatically, how do tell derby where the classes are located? -- Sent from:

Re: Calling a java function from a trigger

2019-09-12 Thread fkalim
To give more information, I compile my code into a jar, install the jar and then try to use the Java file in the jar. The name of the java class is TestListener. When I use the sql code below, I get the error: ERROR 42X51: The class 'APP.TestListener' does not exist or is inaccessible. This can

Re: Calling a java function from a trigger

2019-09-12 Thread fkalim
Thanks! I tried that first and got the following error. It was only after that that I went down this path of trying to set derby.database.classpath. Any ideas would be great! SQL [CREATE TRIGGER extract_keyword_trigger AFTER INSERT ON TEMP REFERENCING NEW AS newTable FOR EACH ROW CALL