Please enable JavaScript to view this site.

The manual for the JobRouter developer

Navigation: System activities > Description of the PHP API for system activities > API methods > Other useful API methods

getDBConnection(): JobDB

Scroll Prev Top Next More

This function allows you to access external databases.

Parameter

Typ

Description

$connectionName

string

Name of an external database connection, linked to the process

The function returns an object of type JobDB, which can be used to execute statements on the database.

In case of on error, a JobRouterException is thrown.n.

Example:

$conn = $this->getDBConnection('ERP');

 

$result = $conn->preparedSelect(

   'SELECT inv_nr, inv_title FROM INVOICES WHERE supplier_nr = :supplier_nr',

   ['supplier_nr' => 'S123'],

   [JobRouter\Common\Database\ConnectionInterface::TYPE_TEXT],

);

$invoices = $result->fetchAll();