on 2014 Jan 09 2:52 PM
Dear Experts,
Could you please assist with the issue regarding scheduled job inside of HANA DB.
Seems that all is in place, but for some reasons job is not triggered...
What I done:
1. Set configuration option scheduler/enabled - > true
2. Created xsjob file
{
"description":"Notification jobs",
"action":"services.jobsServiceTest.xsjs::doTest",
"schedules":[
{
"description":"Notification jobs",
"xscron":"* * * * * * 58"
}
]
}
3. xsjs service code
function doTest() {
var conn = null;
try {
conn = $.db.getConnection();
var pstmt = conn.prepareStatement("insert into \"xxx\".\"xxx.SFSJob\" (\"JOB_NAME\",\"JOB_TIME\") values (?,?)");
pstmt.setString(1, "SFS Job");
pstmt.setString(1, new Date());
var rs = pstmt.executeQuery();
pstmt.close();
} catch (e) {
} finally {
if (conn) {
conn.close();
}
}
}
JOBS TABLE content
NAME; DESCRIPTION; ACTION; USER; LOCALE; STATUS; START_TIME; END_TIME
services::notifications; Notification jobs; services.jobsServiceTest.xsjs::doTest; ?; ?; ACTIVE; ?; ?
4.Checked that corresponding records created inside the JOBS and JOB_SCHEDULES tables for the _SYS_XS user
5. Job is not triggered - No records in the JOB_LOG table, no records in the SFSJob table
Could you please advise.
Regards,
Alexander
Request clarification before answering.
Problem is resolved.
In my case:
1. By default job has INACTIVE status unless it marked as ACTIVE via Hana admin console
In case when I changed the status to Active via sql it did not impact the triggering process, so seems that we can explicitly Active the job via admin console
2. To see Hana Jobs admin console it is necessary to find the corresponding xsjob file in the applications tree.
Actually I was expecting to see a separate Jobs Navigation tab (like Trust Manager) for the all Hana jobs defined.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have same issue and resolve after perform following command on HANA machine.
1.check cron tab job is running or not.
perform following command on HANA machine terminal.
#sudo systemctlstatus cron
2.if service is inactive then perform following command.
#sudo systemctlstart cron
Regards,
Abid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am facing a similar problem:
Have followed all of the steps from the developer guide (page 469-472): http://help.sap.com/hana/SAP_HANA_Developer_Guide_en.pdf
but the job is not executing, neither it is showing in the JOB Log.
scheduleInsert.xsjob
{
"description": "Scheduled Insert",
"action": "sap....appl.services:testInsert.xsjs::insert",
"schedules": [
{
"description": "insert",
"xscron": "* * * * * * 0:59/10"
}
]
}
sap....appl.services:testInsert.xsjs
$.import("sap....appl.xsjslib", "dummyInsert");
function insert() {
var dbConnection = null;
var output = null;
var bo = null;
var payload = null;
dbConnection = $.db.getConnection(); //Get dbConnectionection for DB
bo = new $.sap....appl.xsjslib.dummyInsert.Value( dbConnection );
output = bo.insertValue(JSON.parse("[\"1\"]"), 10, true);
dbConnection.close();
dbConnection = null;
bo = null;
$.response.status = output.HttpStatusCode;
$.response.setBody(JSON.stringify(output) + '\n');
}
Thanks & Regards,
Rachit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have the same problem as Rachit described. The only difference in our case is that we try to run SQLScript from the job. The job is set to active in the XS Admin Console, but the SQLScript is not executed -> the respective DB table does not get the new entries, coming from the SQLScript...
Any advice how to solve the problem will be highly appreciated!
Best regards,
Alex
Hi Alex,
My problem got resolved.
Problem:
Solution:
I hope this helps you.
PS: Do check if you have [scheduler] enabled = true in xsengine
Best regards,
Rachit
Hi Alex
what was the syntax for your SQl script in the xs cron job file. It is not working for me. I get error "Access to source denied". I am using the following syntax in the action keyword "PredictiveA.PredictiveAB:generate.sql" where Predictive A is the root package and while predictive AB is sub-package.
Thanks
Saleem
User | Count |
---|---|
73 | |
21 | |
9 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.