Inserting and Retrieving records in to database(sql) using IBM BPM

In this blog I will show you how we can insert a record in to sql table and also retrieving the record from table.

Inserting data into database :

First we need to start with creating the service. Here we need to create Integration service.The values which we need to insert in to table will be obtained as an input to service.

Here I have only single complex object as input to service, but we can even have multiple input variables as input.Coming to the diagram , first the sql query needs to be written. For that I have used server scriptlet and I’ve binded that to sql variable. So that we can use that for bindings later.


Here I have used internal DB so there is no need of any schema for CRUD operations . But if we are connecting to external sql server we need to have db schema.

NOTE :  As a good practice DB schema needs to created as an epv variable and can be referenced in the service. So that any change in the schema details needs updation just at one place.

<# var schema = String(tw.epv.MHV_CONSTANT.INFLIGHT_DB_SCHEMA_NAME) + "." + String(tw.epv.MHV_CONSTANT.INFLIGHT_DB_GROUP); #>

INSERT INTO <#= schema #>.H_EmployeeDetails (*,*,*) VALUES (?,?,?)

Then we need  to initialize parameters as List of  SQL Parameter type as we need to pass that as input to SQL Execute Statement nested service.Then in this parameters we need to have initialization for all the values that we pass in our SQL query.

tw.local.parameters = new tw.object.listOf.SQLParameter();

tw.local.parameters[0] = new tw.object.SQLParameter();
tw.local.parameters[0].value = tw.local.employeeDetails.employeeId;
tw.local.parameters[0].mode = "IN";

tw.local.parameters[1] = new tw.object.SQLParameter();
tw.local.parameters[1].value =;
tw.local.parameters[1].mode = "IN";

tw.local.parameters[2] = new tw.object.SQLParameter();
tw.local.parameters[2].value =;
tw.local.parameters[2].mode = "IN";


Then we need to have the SQL Execute Statement Nested service. Then  we need to do the necessary bindings


Now the service is ready for the insertion of data in to sql table.

Retrieving data from database :

Coming to retrieving data from table, It is similar to insertion but we need to mention the returnType , how we are expecting the result. It may be some business object type, XMLElement, NameValuePair etc., If it is other than business object type then we need to parse that response before sending that as output. I will show both the ways

  1. If return type is set as business Object type then results and output variable should also be of same business object type.retrieveinput.png

Initializing the params is same.We need to initialize the input variable here

tw.local.parameters = new tw.object.listOf.SQLParameter();

tw.local.parameters[0] = new tw.object.SQLParameter();
tw.local.parameters[0].value = tw.local.empId;
tw.local.parameters[0].mode = "IN";


So we will have the response in results variable. Then you need to assign that to your output variable.It can done in the Post-execution Assignment.

tw.local.employeeData = tw.local.results[0]

2.If the return type is of type XMLElement , please check here

Please do comment if you have any questions . Hope this helps someone and have a good day!

Connecting to MongoDB service on bluemix using Node JS application and inserting data

In this blog,I will show you how to connect to Compose for MongoDB service on bluemix from our Node js application and then how to insert some data in to a collection.
First thing is that we need to create a new Compose for Mongo DB service On Bluemix.


In the credentials you will have uri which is important and you need only that to connect from your node application


Once you have  these you can start with your Node js application.
You require mongodb npm package to connect to this.So you need to import this module other than the default modules.
We need to use MongoClient constructor to connect to mongodb

var express = require('express');
var router = express.Router();
var bodyParser = require('body-parser');
var MongoClient = require('mongodb').MongoClient;
var collectionName = "";
var options = {
  mongos: {
    ssl: true,
    sslValidate: false,
var mongo=process.env.VCAP_SERVICES;
var port = process.env.PORT || 3030;
var conn_str = "";
var mongoDbConn;

As I told earlier ,we need mongo uri to connect.We can directly hardcode that in our code or else we can bind a custom provided service(cups) to your bluemix application and access that value using VCAP_SERVICES.Second option is the best one as dont need any hardcoding.
So here we need to bind that service to our application on bluemix. In above code mongo is directly accessing that service. Now we need to capture the uri value from that and connect to mongo using the MongoClient which is done below

if (mongo) {
  var env = JSON.parse(mongo);
  if (env['user-provided']) {
    mongo = env['user-provided'][0]['credentials'];
    if (mongo.uri) {
      conn_str = mongo.uri;

      MongoClient.connect(conn_str, options, function (err, db) {
        if (err) {
          res.send("Mongo DB with conn ${conn_str} has error ${err}");
        } else {
          mongoDbConn = db;

    } else {
      console.log("No mongo found");
  } else {
    console.log('No mongo found');
} else {
  console.log('No mongo found');

You can also directly hardcode your value for mongo.uri value if required.
So once you have your mongo connection,you don’t need to connect every time when you need to add some data or insert anything using rest call .You just need to use mongoDbConn .
In below example I will show you a POST call which will insert data in to a collection using mongoDbConn'/insertnewevent', function (req, res) {
  var eventdetails = req.body;
  var data = { "customer": "harish", "transactionID":"3405123","transdate":"11/06/17"};
  var collectionName = "logdetails";

  if (mongoDbConn) {
    // list messages
    mongoDbConn.collection(collectionName).insert(data, function (err, cursor) {
      if (err) {
        res.send('mongodb message list failed');
      } else {
        res.send("Inserted the event successfully and reference ID is " + data._id);

So this way can easily connect to your MongoDB on bluemix service from your node js application.
Note:You can combine all the 3 code snippets in order and it will work.
If you face any issues in connecting you can comment here.
Hope it helps someone!

Architecture of IBM BPM

There are number of functional components in IBPM Iam going to tell the basics of those components.



Process Center:

It is the brain of BPM.We cannot work without a process center because that’s where development happens.The process center is called as a shared model.It means that,no matter what is being done with the over all solution,there is only one common repository and a single representation of that solution.Because of this, it is impossible to get two phases of the same solution out of synch with each other.

For example two people are working on same artifact at a time(eg:bpd).For one who works first will be editable and for the other it will be read only until the first person saves.Thus the data will always be in synch.

The process center is actually comprised of three components:

Process Center Server:

Enables you to run the processes as you build them.When your process is ready you can run that on test,production environments.Thus the process server will provide different run time environments where the developer can run the processes at different stages.

Process Center Repository: It is responsible for managing the solution’s artifacts.

Performance Data WareHouse:

It is responsible for collecting and managing the historical data of all the BPD’s and tasks that are run in the process server instances or the process center environment

Hip Hip HURRAY!!!!!

Be careful world on criticising  INDIA,here is our  most dynamic  PRIME MINISTER ever #NARENDRA MODI…a normal person from #tea vendor   to mammoth #prime minister  of #INDIA….


New Game Begins… New Shine will come to our doorstep. Lots off Hopes from you.. Best wishes…

Tribute to Nelson Mandela

Tribute To Nelson Mandela

Tributes have flown in from around the world for South Africa’s revered anti-apartheid icon Nelson Mandela, who has died aged 95.

Mr Mandela – who was often referred to in his home country by his clan name Madiba – passed away peacefully at his Johannesburg home.

South African president Jacob Zuma announced the news of Mandela’s death, saying in a nationally televised address: “Fellow South Africans, our beloved Nelson Rohlihla Mandela, the founding president of our democratic nation, has departed.”

He added: “Our people have lost a father. Although we knew this day was going to come, nothing can diminish our sense of a profound and enduring loss. His tireless struggle for freedom earned him the respect of the world. His humility, passion and humanity, earned him their love.”

Barack Obama

US president Barack Obama said he considered himself among the “countless millions who drew inspiration from Nelson Mandela’s life”, and the world was unlikely to see the likes of him again.

Barack Obama in Mandela's cell on Robben Island

pic::obama stands in mandela’s old prison cell on Robben island near capetown

“He achieved more than could be expected of any man and today he’s gone home and we’ve lost one of the most influential, courageous and profoundly good human beings that any of us will share time with on this Earth. He no longer belongs to us, he belongs to the ages,” America’s first black president said in a televised White House address.

“Through his fierce dignity and unbending will to sacrifice his own freedom for the freedom of others, Madiba transformed South Africa and moved all of us. His journey from a prisoner to a president embodied the promise that human beings and countries can change for the better.

“His commitment to transfer power and reconcile with those who jailed him set an example that all humanity should aspire to, whether in the lives of nations or our own personal lives. The fact that he did it all with grace and good humour and an ability to acknowledge his own imperfections only makes the man that much more remarkable.”

David Cameron

British prime minister David Cameron said, “A great light has gone out in the world”, adding that flags at Number 10 Downing Street would be flown at half-mast in tribute to Mandela.

“Nelson Mandela was a towering figure in our time; a legend in life and now in death – a true global hero,” Mr Cameron said in a statement.

“Meeting him was one of the great honours of my life. My heart goes out to his family – and to all in South Africa and around the world whose lives were changed through his courage”

Tony Abbott

Prime Minister Tony Abbott paid tribute to Mandela during a radio interview on 3AW.

“Nelson Mandela was one of the great figures of Africa, arguably one of the great figures of the last century,” he said.

“A truly great man. And while I never met him, I did read that book A Long Walk To Freedom, and I guess the impression we get of Nelson Mandela is someone who suffered but was not embittered but ennobled through that suffering.”

Queen Elizabeth II and Prince Charles

Queen Elizabeth II said she was “deeply saddened” by the death of Mandela, adding that he had “worked tirelessly for the good of his country”.

“The Queen was deeply saddened to learn of the death of Nelson Mandela last night. He worked tirelessly for the good of his country, and his legacy is the peaceful South Africa we see today,” Buckingham Palace said in a statement.

Mr Mandela was the embodiment of courage and reconciliation.

Prince Charles

“Her Majesty remembers with great warmth her meetings with Mr Mandela and sends her sincere condolences to his family and the people of South Africa at this very sad time.”

Prince Charles also paid tribute to the iconic anti-apartheid fighter, describing him as an “inspired leader and a great man”.

“Mr Mandela was the embodiment of courage and reconciliation. He was also a man of great humour and had a real zest for life,” he said.

“With his passing, there will be an immense void not only in his family’s lives, but also in those of all South Africans and the many others whose lives have been changed through his fight for peace, justice and freedom.

“The world has lost an inspired leader and a great man. My family and I are profoundly saddened and our thoughts and prayers are with his family.”


South Africa’s ruling party, the African National Congress, said that in its one-time leader South Africa had lost “a colossus, an epitome of humility, equality, justice, peace and hope of millions”.

“His life gives us the courage to push forward for development and progress towards ending hunger and poverty,” the party said in a statement.

F.W. de Klerk

South Africa’s last white president, F.W. de Klerk, said Mandela’s greatest accomplishment was to unify the country and push for reconciliation between blacks and whites in the post-apartheid era.

“He was a great unifier and a very, very special man in this regard beyond everything else he did. This emphasis on reconciliation was his biggest legacy,” Mr de Klerk said in an interview with CNN.

Mr De Klerk, who released Mandela from prison in 1990 and then negotiated the end of apartheid, called Mandela a “humane” and “compassionate” man who was able to understand the fears of South Africa’s white minority in the transition to democracy.

Mandela and Mr de Klerk shared the 1993 Nobel Peace Prize for ending minority white rule and laying the foundations of democracy, with Mr De Klerk going on to serve as one of two deputy presidents in Mandela’s government after the ANC won the 1994 elections.

Desmond Tutu

South Africa’s archbishop emeritus Desmond Tutu lauded his compatriot and fellow Nobel peace laureate as the man who taught a deeply divided nation how to come together.

“Over the past 24 years Madiba taught us how to come together and to believe in ourselves and each other. He was a unifier from the moment he walked out of prison,” Archbishop Tutu said.

“We are relieved that his suffering is over, but our relief is drowned by our grief. May he rest in peace and rise in glory.”

Tutu dismissed doomsayers who have long predicted South Africa will fall apart after Mandela’s death.

The sun will rise tomorrow, and the next day and the next… It may not appear as bright as yesterday, but life will carry on.

Desmond Tutu

“To suggest that South Africa might go up in flames – as some have predicted – is to discredit South Africans and Madiba’s legacy,” he said in a statement.\

“The sun will rise tomorrow, and the next day and the next… It may not appear as bright as yesterday, but life will carry on.”

“As we enter the mourning period, as a nation, we do so with the greatest dignity and respect because that is what we owe Madiba and ourselves.”

Ban Ki-moon

The UN Security Council was in session when the ambassadors received the news of Mandela’s death. They stopped their meeting and stood for a minute’s silence.

UN secretary-general Ban Ki-moon hailed Mandela as a “giant for justice” who had inspired freedom movements the world over.

“Many around the world were influenced by his selfless struggle for human dignity, equality and freedom. He touched our lives in deeply personal ways,” he told reporters.

“Nelson Mandela was a giant for justice and a down-to-earth human inspiration.”

Angela Merkel

German Chancellor Angela Merkel said Mandela’s name would always be associated with the fight against the oppression.

“Not even years in prison could break Nelson Mandela or make him bitter – a new, better South Africa eventually emerged out of his message of reconciliation,” she said.

“Nelson Mandela’s shining example and his political legacy of non-violence and the condemnation of all forms of racism will continue to inspire people around the world for many years to come.”

Francois Hollande

French president Francois Hollande said in a statement that: “Nelson Mandela made history. That of South Africa and the whole world. Nelson Mandela’s message will not disappear. It will continue to inspire fighters for freedom, and to give confidence to peoples in the defence of just causes and universal rights.”

Benjamin Netanyahu

Israeli prime minister Benjamin Netanyahu described Mandela as “one of the most honorable figures of our time”.

He was the father of his people, a man of vision, a freedom fighter who rejected violence.

Benjamin Netanyahu

“He was the father of his people, a man of vision, a freedom fighter who rejected violence,” he said.

“He set a personal example for his people in the long years he spent in prison. He was never arrogant. He worked to mend the tears in South African society and with his character managed to prevent outbursts of racial hatred.”

Aung San Suu Kyi

Myanmar veteran democracy advocate Aung San Suu Kyi described Mandela as a “great human being who raised the standard of humanity”.

“I would like to express my extreme grief at the passing away of a man who stood for human rights and equality,” she said.

“He made us all understand that nobody should be penalised for the colour of their skin or for the circumstances in which he is born.

“He also made us understand we can change the world by changing attitudes, by changing perceptions.”

Enda Kenny

The boy from the Transkei has finished his long walk.

Enda Kenny

Irish prime minister Enda Kenny said Mandela transformed not only South Africa, but humanity itself.

“The name Mandela stirred our conscience and our hearts. It became synonymous with the pursuit of dignity and freedom across the globe,” he said.

“Today, a great light has been extinguished. The boy from the Transkei has finished his long walk. His journey transformed not just South Africa, but humanity itself.”

Bill Clinton

Former US president Bill Clinton, who was in office when Nelson Mandela took power in South Africa, mourned the death of a “champion for human dignity and freedom”.

“Today the world has lost one of its most important leaders and one of its finest human beings,” Mr Clinton said in a statement.

“History will remember Nelson Mandela as a champion for human dignity and freedom, for peace and reconciliation.

The Clinton and Mandela families became close, with the former US president visiting Mandela on the eve of his 94th birthday.

“Hillary, Chelsea and I have lost a true friend,” Mr Clinton said.

“All of us are living in a better world because of the life that Madiba lived. He proved that there is freedom in forgiving, that a big heart is better than a closed mind, and that life’s real victories must be shared.”

George H.W. Bush

Former US president George H.W. Bush said Mandela changed the course of history.

“As president, I watched in wonder as Nelson Mandela had the remarkable capacity to forgive his jailers following 26 years of wrongful imprisonment – setting a powerful example of redemption and grace for us all,” he said.

“He was a man of tremendous moral courage, who changed the course of history in his country.”

Tony Blair

He made racism everywhere not just immoral but stupid.

Tony Blair

Former prime minister Tony Blair recalled Mandela as “a wonderful man to be around, with a sharp wit, extraordinary political savvy and a lovely way of charming everyone in a building”.

“Through his dignity, grace and the quality of his forgiveness, he made racism everywhere not just immoral but stupid; something not only to be disagreed with, but to be despised. In its place he put the inalienable right of all humankind to be free and to be equal,” Mr Blair added.

Mohamed ElBaradei

Mandela’s fellow Nobel laureates were among those paying tribute, including the Egyptian former head of the IAEA nuclear watchdog Mohamed ElBaradei, who declared: “Let freedom reign. Humanity has lost its greatest son”.

Malcolm Fraser

He wasn’t one of the great men of the last century, or of this. He was head and shoulders above anyone else from the last century.

Malcolm Fraser

Former Australian prime minister Malcolm Fraser described Mandela as a towering figure of the last century.

“It’s very hard to find the words to do justice to Mandela, because he wasn’t one of the great men of the last century, or of this,” he said.

“He was head and shoulders above anyone else from the last century.”

Goodluck Jonathan

Nigerian president Goodluck Jonathan said Mandela’s death “will create a huge vacuum that will be difficult to fill in our continent.”

“He will be sorely missed by all who cherish love, peace and freedom the world over…”

Xi Jinping

Chinese president Xi Jinping described Mandela as an “active champion of bilateral friendship and cooperation” and “one of the founders of China-South Africa relations”.

“Mr Mandela was a world-renowned statesman, who during the long years led the South African people through arduous struggles to the anti-apartheid victory, making a historic contribution to the establishment and development of the new South Africa,” he said.

Oprah Winfrey

Being in his presence was like sitting with grace and majesty at the same time.

Oprah Winfrey

American talk show host Oprah Winfrey added her voice to the tributes, saying Mandela “will always be my hero”.

“One of the great honours of my life was to be invited to Nelson Mandela’s home, spend private time and get to know him,” she said.

“He was everything you’ve ever heard and more – humble and unscathed by bitterness. And he always loved to tell a good joke.

“Being in his presence was like sitting with grace and majesty at the same time. His life was a gift to us all.”

Morgan Freeman

Actor Morgan Freeman played Mandela in Clint Eastwood’s 2009 film Invictus about the events surrounding the World Cup.

“Today, the world lost one of the true giants of the past century… a saint to many, a hero to all who treasure liberty, freedom and the dignity of human kind,” he said.

Nicolas Maduro

Venezuelan president Nicolas Maduro declared three days of national mourning.

“Nine months since the passing of our comandante [Hugo Chavez], another giant of the people of the world passed away today. Madiba, you will live forever!” Maduro said on Twitter.

Jimmy Carter

The people of South Africa and human rights advocates around the world have lost a great leader.

Jimmy Carter

Former US president Jimmy Carter said that Mandela’s death meant that people “around the world have lost a great leader”.

“His passion for freedom and justice created new hope for generations of oppressed people worldwide, and because of him, South Africa is today one of the world’s leading democracies,” he said.

Shinzo Abe

Japanese prime minister Shinzo Abe said Mandela “fought for the abolition of apartheid with strong will”.

“On nation building, he made a major achievement with focus on the reconciliation of the people. He was a great leader,” he said.


Thank You Sachin Ramesh Tendulkar

Sachin Tendulkar’s career in numbers


Sachin Tendulkar's 34,000 runs


The key to Tendulkar amassing more than 34,000 international runs in his record-breaking 24-year career has been his consistency and longevity in both Test and one-day international cricket.

He has made more appearances and accumulated more runs in both forms of the game than any other cricketer, although he has only made one appearance for India in Twenty20 internationals.


Five leading century scorers

Tendulkar Ponting Kallis Lara Sangakkara
TESTS Appearances 200 168 164 131 117
Runs 15,921 13,378 13,140 11,953 10,486
Average 53.78 51.85 55.44 52.14 56.98
Centuries 51 41 44 34 33
ODIs Appearances 463 375 321 299 356
Runs 18,426 13,704 11,498 10,405 11,932
Average 44.83 42.03 45.26 40.48 40.31
Centuries 49 30 17 19 16


Tendulkar, who made his India debut as a 16-year-old in 1989, holds several records, most famously becoming the first player to hit a hundred centuries in international cricket when he scored 114 against Bangladesh in Dhaka in March 2012.

Former Australia batsman Ricky Ponting is next in the list of highest century-makers with 71, and many players and commentators have suggested that Tendulkar’s total may never be beaten.

Sachin Tendulkar's records. Most runs scored: 15,921 in Tests (nearest batsman Ponting: 13,378) and 18,426 in one-day internationals (nearest batsman Jayasuriya: 13,430). Most centuries: 51 in Tests (nearest batsman Kallis: 44) and 49 in one-day internationals (nearest batsman Ponting: 30). Most innings: 329 in Tests (nearest batsman Ponting: 287)and 452 in one-day internationals (nearest batsman Jayasuriya: 433).


* Innings and runs includes one T20 match

It had been two years since Tendulkar’s 99th century, scored against South Africa, and in between there were 12 one-day internationals and 11 Tests without a century.

The closest he got in that time was 94 batting against the West Indies in Mumbai in November 2011.

Compare this with the previous 20 matches, in which he scored seven centuries: three in one-day matches and four in Tests.


Tendulkar has had 1,610 batting partnerships with 82 different batsmen. He had faced 846 bowlers. If each bowler lined up to bowl one over at him it would take 9 full test days and a morning session.

Even the greatest batsmen get out though.

Tendulkar has been dismissed 681 times in his career and for just over 60% of those dismissals he was out caught.


How Tendulkar was dismissed during his career. Caught 427, bowled 123, lbw 102, not out 73, run out 43, others 14.