• Database Connetion

  • A non-process control that connects only to a database and is easy to call in JavaCompute. The database Jar file is put into the lib directory.
  • Properties

    • class
    • name
    • driver
    • url
    • username
    • password
    • validationQuery
  • Example


  • The connection object is called in the JavaCompute code:
    package sashulin.apps;
    import sashulin.applications.FlowApi;
    import java.sql.*;
    public class dbFlow_JavaCompute1 {
    	private String routeLabels = "";
    	public String execute(String message){
            Connection conn = FlowApi.getDataBaseConnection(this,"Connection1");
            if (conn != null){
                    try {
                        Statement statement = conn.createStatement();
                        esultSet rs = statement.executeQuery("select * from esb_log_20211 ");
                        while(rs.next()){
                            String value = rs.getString("messageID");
                            System.out.println(value);
                            int columnIndex = rs.findColumn("responseText");
                            System.out.println(columnIndex);
                        }
                        FlowApi.printLog("rad","ok...");
                } catch(Exception e) {
                    FlowApi.printLog("rad",e.getMessage());
                    e.printStackTrace();
                }
     
            }
    		return "Compute1:"+message;
    	}
     
    	public String getRouteLabels(){
    		return routeLabels;
    	}
    }