Calling pubdbexecSQL from a java service

I am writing a java service which should do database lookup, I am calling execSql flow service from within java service. I am able to successfully query the database but unable to understand how to read the resultset values from results key which is the output from execsql flow service.

NSName sqlservice = NSName.create(“pub.db:execSQL”);
IDataCursor inputDataCursor = inputData.getCursor();
IDataUtil.put(inputDataCursor, “$dbAlias”, “DB_QA”);
IDataUtil.put(inputDataCursor, “$dbSQL”, "select field1 from table );
IData data = Service.doInvoke(sqlservice,inputData);
IDataCursor resultdata = data.getCursor();

I am not sure how to read the output from resultdata cursor.

help is very much appreciated.



Can we know why are you using a JavaService for doing this job?instead you can build a wrappter flowservice and invoke execSQL service(query the DB) which gives output Results(Recordlist),then loop thru the resultset using LOOP step and extract the data from the individual fields and map to target structure or what ever your process flow is.

This makes easier and fast development.