- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 01:40 AM
Hi Team,
I am getting this below error in response entry in the ecc_queue via mid server during insert operation via JDBC Prod. Could you please suggest what to do. I am unable to access the hi article on the same which is mentioned in the other post related to this issue, can some one suggest how to fix this or post the content of the hi support article related to this.
!
Regards,
Atul Kumar
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 05:34 AM
Hi Tony,
Managed to resolve the issue by below code.
// Obtain MID Server
var mid = new GlideRecord('ecc_agent');
mid.addQuery('name','sdbx');
mid.query();
mid.next();
// Get a specific Data Source (predefined to connect to a specific database instance)
var ds = new GlideRecord('sys_data_source');
ds.addQuery('sys_id','b67a63a7dummy0128144b0ed');
ds.query();
ds.next();
gs.log("DataSource:" + ds.sys_id);
//Create a JDBC Probe to Select/Query
var u = new JDBCProbe(mid.name);
u.agent_correlator=u.addParameter('agent_correlator',gs.generateGUID());
u.setDataSource(ds.sys_id);
u.setTable("ODRPOC.INCIDENT");
u.setFunction("insert");
u.addField("SHORT_DESCRIPTION", "My chair will not roll smoothly");
u.addNumberField("PRIORITY", 1);
u.addField("URGENCY", "2");
u.addField("IMPACT", "1");
u.addField("IMPACT", "1");
u.create();
Thanks.
Regards,
Atul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 01:51 AM
Hi Atul,
Could you identify the other post?
I might not be the same issue - null pointer exception for JDBC Probe may have different causes.
In the meantime did this functionality used to work and has now stopped?
Best Regards
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 02:49 AM
Hi Tony,
This is first time implementation. I am using below code via script background to check.
var j = new JDBCProbe("mid");
j.setDriver("Oracle - oracle.jdbc.OracleDriver");
j.setConnectionString("jdbc:oracle:thin:<POC/oc123>@uni_DB>");
j.setTable("INCIDENT");
j.setFunction("insert");
j.addField("summary", "My chair will not roll smoothly");
j.addNumberField("priority", 1);
j.addField("urgency", "2");
j.addField("impact", "1");
j.create();
Regards,
Atul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 04:05 AM
Hi Atul,
I have not used JDBC probe for insert or update, but maybe the posting you referred to earlier is this one?
In this post
Suraj Sampath mentioned a solution like so
..
Yes, the solution is adding 2 new parameters: jdbc_user_name and jdbc_password to the parameter list.
here is the code:
var xml = '<?xml version="1.0" encoding="UTF-8"?>';
xml = '<parameters>';
xml += '<parameter name="jdbc_driver" value=\"'+driver+'\"/>';
xml += '<parameter name="jdbc_user_name" value=\"'+jdbc_user_name+'\"/>';
xml += '<parameter name="jdbc_password" value=\"'+jdbc_password+'\"/>';
..
Is that helpful?
Best Regards
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 04:59 AM
Hi Tony,
I tried as per the HI Article it is stating below and i did so but still i can see agent corelator giving null.
The agent_correlator is a new requirement for ecc_queue records in Geneva. This field associates outbound requests with the resulting response record in the ECC queue. This issue occurs because the JDBC Probe that is created via the script include is not providing a value for the agent_correlator field. Therefore, when the MID server processes the response to the JDBCProbe, it fails to find a value and throws a null pointer exception.
Here is the script include-
------------------------------------------
gs.include("PrototypeServer");
var JDBCProbe = Class.create();
JDBCProbe.prototype = {
initialize : function(mid_server) {
this.midServer = mid_server;
this.name = "JDBCProbe"; // optional probe name
this.payloadDoc = new GlideXMLDocument("parameters");
this.farray = {};
this.fNarray = {};
this.functionName = "insert";
this.tableName;
this.whereClause;
this.dataSource;
},
setName : function(name) {
this.name = name;
},
addParameter : function(name, value) {
var el = this.payloadDoc.createElement("parameter");
el.setAttribute("name", name);
if (value)
el.setAttribute("value", value);
return el;
},
setDriver : function(driver) {
this.addParameter("jdbc_driver", driver);
},
setDriverJar : function(driverJar) {
this.addParameter("jdbc_driver_jar", driverJar);
},
setConnectionString : function(connectionStr) {
this.addParameter("connection_string", connectionStr);
},
addField : function(name, value) {
this.farray[name] = value;
},
addNumberField : function(name, value) {
this.fNarray[name] = value;
},
setFunction : function(f) {
this.functionName = f;
},
setWhereClause : function(w) {
this.whereClause = w;
},
setTable : function(t) {
this.tableName = t;
},
setDataSource : function(source) {
this.dataSource = source;
},
create : function() {
var egr = new GlideRecord("ecc_queue");
egr.agent = "mid.server." + this.midServer;
egr.queue = "output";
egr.state = "ready";
egr.topic = "JDBCProbe";
egr.name = this.name;
if (this.dataSource) {
egr.source = this.dataSource;
}
if (this.functionName) {
var workEl = this.addParameter("work");
this.payloadDoc.setCurrent(workEl);
var funcEl = this.payloadDoc.createElement(this.functionName);
funcEl.setAttribute("table", this.tableName);
if (this.whereClause) {
funcEl.setAttribute("where", this.whereClause);
}
this.payloadDoc.setCurrent(funcEl);
for(nextKey in this.farray) {
var v = this.farray[nextKey];
var el = this.payloadDoc.createElement(nextKey, v);
}
for(nextKey in this.fNarray) {
var v = this.fNarray[nextKey];
var el = this.payloadDoc.createElement(nextKey, v);
el.setAttribute("quoted", "false");
}
}
egr.payload = this.payloadDoc.toString();
return egr.insert();
},
type: 'JDBCProbe'
};
----------------------------------------------------------------------
Command being executed on script background.
var j = new JDBCProbe("midserver-sdbx");
j.setDriver("Oracle - oracle.jdbc.OracleDriver");
j.setConnectionString("jdbc:oracle:thin:<OD/odr3223123>@10.52.206.19:1521:TR_DB");
j.setTable("ODRP.INCIDENT");
j.setFunction("insert");
j.addField("summary", "My chair will not roll smoothly");
j.addNumberField("priority", 1);
j.addField("urgency", "2");
j.addField("impact", "1");
j.create();
--------------------------
Result in the input response in the JDBC PROB under queue.
I also twiked and used the below code from snow but still it is not generating the agent_correlator value.
obj.agent_correlator=obj.addParameter('agent_correlator',gs.generateGUID());
Can some one advise.
Regards,
Atul kumar