Execution of (java) TRIGGER failed in OE sql engine; Error C

Posted by Rom Elwell on 26-Nov-2019 13:10

EDIT: I have ensured the sql environment is setup, including stopping the DBs and running 'sql_env' from proenv.

I have created a Java trigger that fires on Update of the Employee table.  When I execute a simple Update statement in SquirrellSQL to test, the following error is returned.  

Error: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Execution of TRIGGER, PUB.SQLEMPLOYEEUPDATE failed in OE sql engine at line Z:/vobs_sql/sql/src/sqlsp/cxx/DDMJavaCache.cxx : 958.(19152)
SQLState: HY000
ErrorCode: -210154

Google-fu is failing me as I am unable to find any references to this message or the associated error code.  I'm hoping someone here can shed some light on the matter for me.  Thanks in advance!

All Replies

Posted by Mohd Sayeed Akthar on 26-Nov-2019 15:21

Hi Rom Elwell,

The code path which error message is showing is responsible for loading class associated with the trigger, which fails here.

Can we know which version of OE that you are using and is it possible to have a reproducible?

Thanks,

Akthar.

Posted by Rom Elwell on 26-Nov-2019 17:28

[quote user="Mohd Sayeed Akthar"]

Hi Rom Elwell,

The code path which error message is showing is responsible for loading class associated with the trigger, which fails here.

Can we know which version of OE that you are using and is it possible to have a reproducible?

Thanks,

Akthar.

[/quote]Mohd,

Thanks for the reply.  We are running OE 11.7.4 x64.  A sample of the java trigger is below for review.  Our Java Triggers fire after data has been updated in the OE DBs via a SQL Client, such as SquirrelSQL.  The trigger establishes a connection to an Apache Tomcat web server and passes data related to the updated data.  The Java snippet in the trigger was first written in the Java IDE BlueJ and successfully tested.  The Trigger was created by running the code in a SQL Editor within Progress Developer Studio.

CREATE TRIGGER sqlemployeeUPDATE

AFTER UPDATE OF

field1,field2,field3,field4

ON PUB.TABLENAME

REFERENCING NEWROW

FOR EACH ROW

IMPORT

import java.io.IOException;

import java.io.OutputStreamWriter;

import java.io.InputStreamReader;

import java.io.InputStream;

import java.io.BufferedReader;

import java.lang.*;

import java.net.HttpURLConnection;

import java.net.URL;

import java.sql.*;

import java.util.*;

BEGIN

try {

   String dbURL = "jdbc:datadirect:openedge://HOSTNAME:PORT;databaseName=DBNAME";

   String userID = "USER";

   String password = "PASSWORD";

   String sql =  "SELECT serverURL FROM pub.company";

   String serverURL = null;

   String pkValue = null;

   Connection appCon = null;

   Statement appStmt = null;

   Class.forName("com.ddtek.jdbc.openedge.OpenEdgeDriver");

   appCon = DriverManager.getConnection(dbURL,userID,password);

   appStmt = appCon.createStatement();

   ResultSet rs = appStmt.executeQuery(sql);

   while(rs.next()) {

       serverURL = rs.getString("serverURL");

   }

   serverURL = serverURL + "/appContainer/rest_ws/notify";

   rs.close();

   appStmt.close();

   appCon.close();

   URL url = new URL(appURL);

   HttpURLConnection con = (HttpURLConnection) url.openConnection();

   con.setRequestMethod("PUT");

   con.setRequestProperty("Content-Type", "application/json");

   con.setRequestProperty("Accept", "application/json");

   con.setDoInput(true);

   con.setDoOutput(true);

   OutputStreamWriter output = new OutputStreamWriter( con.getOutputStream() );

   String jsonEntity = " \\\"{ \\\" " +

    " \\\"serverName\\\":\\\"DBNAME\\\", " +

    " \\\"tableName\\\":\\\"DBTABLE\\", " +

    " \\\"pks\\\":[ (String) NEWROW.getValue(2, character), ]," +

    " \\\"action\\\":1 } ";

   output.write(jsonEntity);

   output.close();

   InputStream input = null;

   if (con != null) {

       input = con.getInputStream();

   } else {

       throw new IOException ();

   }

   BufferedReader reader = new BufferedReader(new InputStreamReader(input));

   List<String> response = new ArrayList<String>();

   String line = "";

   while ((line = reader.readLine()) != null) {

       response.add(line);

   }

   reader.close();

   input.close();

   con.disconnect();

   }

  catch (ClassNotFoundException eCls) { }

  catch (java.sql.SQLException eSql) { }

  catch (java.net.MalformedURLException e) { }

  catch (java.io.IOException eIO) { }

END
Posted by bronco on 27-Nov-2019 02:52

Not a direct answer to your question, but would Change Data Capture (CDC) be a solution for this? That way you would be able to separate the transaction and sending the data forward.

Posted by Mohd Sayeed Akthar on 27-Nov-2019 11:59

Hi Rom Elwell,

I have tried to reproduce the issue, but did not succeed. Can you please get in touch with Progress Tech Support.

Thanks,

Akthar.

This thread is closed