Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
exports.activationGroup = "*new";

function connect3() {
  pjs.define("remote_user", { type: "char", length: 10, varying: true, initValue: "**********" });
  pjs.define("remote_pwd", { type: "char", length: 10, varying: true, initValue: "**********" });

  pjs.define("colData", { type: "char", length: 20, varying: true });
  pjs.define("msg", { type: "char", length: 50 });

  pjs.define("c1", { type: "cursor" });
  c1 = pjs.allocStmt();

  pjs.setConnectAttr(SQL_TXN_ISOLATION, SQL_TXN_REPEATABLE_READ);
  pjs.setConnectAttr(SQL_ATTR_DBC_SYS_NAMING, SQL_FALSE);
  
  // Connect to remote DB "devngremote"
  pjs.connect("devngremote", remote_user, remote_pwd);
  c1.executeDirect("select col1 from drussolibrary.connectdb");

  do {
    pjs.fetch(c1, colData);

    if (sqlcod !== 100) {
      msg = colData;
      console.log("" + " " + msg);
    }
  } while (sqlcod !== 100);

  if (c1) c1.close();
  pjs.disconnect();

  flags["LR"] = true;
}

exports.default = connect3;