getRelConnection()

Establishes a connection to a relationship database and returns a DtpConnection object.

Syntax

DtpConnection getRelConnection(String relDefName)
 

Parameters

relDefName
A relationship definition name. The method connects to the database containing the relationship tables for this relationship definition.

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()

Copyright IBM Corp. 1997, 2003