Establishes a connection to a relationship database and returns a DtpConnection object.
Syntax
DtpConnection getRelConnection(String relDefName)
Parameters
Return values
Returns a DtpConnection object.
Exceptions
DtpConnectionException - If an error occurs while trying to establish the database connection.
Notes
This method establishes a connection to the database that contains the relationship tables used by the relDefName relationship, and provides a way to perform queries and updates to the relationship database. The method returns a DtpConnection object through which you can execute queries and manage transactions. See the methods in the DtpConnection class for more information.
The connection is released when the map is finished executing. You can explicitly close this connection with the releaseRelConnection() method.
Examples
The following example establishes a connection to the database containing the relationship tables for the SapCust relationship. It then uses a transaction to execute a query for inserting rows into a table in the SapCust relationship.
DtpConnection connection = getRelConnection("SapCust"); // begin a transaction connection.beginTran(); // insert a row connection.executeSQL("insert..."); // update rows... connection.executeSQL("update..."); // commit the transaction connection.commit();
See also
getDBConnection(), DtpConnection class, releaseRelConnection()