Skip to Content
0
Jan 06, 2020 at 02:36 PM

xsjob not executing in SCP Cloud

154 Views

Hi Experts,

I have checked all the prerequisites of ROLES for XSJOB executions. These are already taken care of.

Though it's not working. Need help.

The codes are given below.

Package List ->

table.hdbdd ->

namespace sampleXSJS;
@Schema: 'TEST_XSJSJOB' 
context table {
   Entity TESTXSJSJOB {
       key ID: Integer;
       DESC: String(100);
   }; 
};


myJobExecutionFile.xsjs ->

function execute() {
    // try {
	var querySelect = "SELECT MAX( \"ID\" ) FROM \"TEST_XSJSJOB\".\"sampleXSJS::table.TESTXSJSJOB\"";


	var connection1 = $.db.getConnection();
	var statement1 = connection1.prepareStatement(querySelect);
	statement1.execute();
	var oResultSet1 = statement1.getResultSet();
	var run_no = 0;
	while (oResultSet1.next()) {
		run_no = oResultSet1.getInteger(1);
	}
	oResultSet1.close();
	statement1.close();
	connection1.close();
	run_no = run_no + 1;

	var query_insert = "INSERT INTO \"TEST_XSJSJOB\".\"sampleXSJS::table.TESTXSJSJOB\" VALUES(" + run_no + ",'" + "TEST " + run_no + "')";
	connection1 = $.db.getConnection();
	statement1 = connection1.prepareStatement(query_insert);
	statement1.execute();
	connection1.commit();
	connection1.close();
}
execute();


testXSJOB.xsjob ->

{
	"description": "TEST Job configuration",
	"action": "sampleXSJS:myJobExecutionFile.xsjs::execute",
	"schedules": [
		{
	   "description": "Will run every 5 seconds between 1-30 seconds of every minute", 
	   "xscron": "* * * * * * 1:30/5"
		}
	]
}


XS ADMIN Config ->


Attachments

xsjob-config.png (60.3 kB)