API to get Orchestration Event Exception from ORCHEVENTS table


  1. package com.oimacademy.orchestration;
  2. import java.io.ByteArrayInputStream;
  3. import java.io.ObjectInputStream;
  4. import java.sql.Connection;
  5. import java.sql.ResultSet;
  6. import java.sql.Statement;
  7. import com.oimacademy.connection.DataSource;
  8. public class DumpOrchEventException {
  9.  public static void main(String[] args) throws Exception {
  10.   long orchEventKey = 10;
  11.   // Connect to the database  
  12.   Connection con = DataSource.getConnection();    
  13.   Statement stmt = con.createStatement();
  14.   String query = "select id, name, status, result from orchevents where id="
  15.     + orchEventKey;
  16.   ResultSet rs = stmt.executeQuery(query);
  17.   while (rs.next()) {
  18.    System.out.println("id = " + rs.getString("id"));
  19.    System.out.println("name = " + rs.getString("name"));
  20.    System.out.println("status = " + rs.getString("status"));
  21.    ByteArrayInputStream bais = new ByteArrayInputStream(
  22.      rs.getBytes("result"));
  23.    ObjectInputStream oip = new ObjectInputStream(bais);
  24.    Object o = oip.readObject();
  25.    Exception ex = (Exception) o;
  26.    ex.printStackTrace();
  27.    System.out.println("****************"+ex.getMessage());
  28.   }
  29.   stmt.close();
  30.   rs.close();
  31.   con.close();
  32.   System.exit(0);
  33.  }
  34. }

No comments:

Post a Comment