pjs.getRemoteDB()

This API was added in Profound.js 7.14.0

This API returns a remote IBMi database connection definition object that can be passed to some SQL and Data APIs to specify the desired database connection. 

Parameters

  1. Database connection name (String). A name corresponding to a remote database connection.

  2. Username (String/Optional). A username to use to login to the remote system.

  3. Password (String/Optional). A password to use to login to the remote system.

Return Value

A remote database connection definition object

 

Using this feature requires the following PTFs:

  • For IBM i 7.4: SJ02815

  • For IBM i 7.5: SJ02127

 

The “remote database connection definition object” can be passed to the following APIs:

pjs.query()
pjs.parallelQueries()
pjs.allocStmt()
pjs.prepare()
pjs.setConnectAttr()
pjs.getConnection()
pjs.createDataArea()
pjs.retrieveDataArea()
pjs.setDataArea()
pjs.data.add()
pjs.data.get()
pjs.data.getCount()
pjs.data.delete()
pjs.data.update()

The return value is passed to the above APIs as the first parameter, followed by the other parameters as documented for each API.

 

Example

pjs.query()
pjs.query("select * from mytable where mycol = ? or mycol = ?", [value1, value2]); // Query runs against default database connection. pjs.query(pjs.getRemoteDB("remote", "user", "pass"), "select * from mytable where mycol = ? or mycol = ?", [value1, value2]); // Query runs against the remote database "remote".