CL_SQL_CONNECTION - Database Connections
The SQL statements that are represented by objects of the CL_SQL_STATEMENT and CL_SQL_PREPARED_STATEMENT classes work by default with the central database of the AS ABAP. ADBC can be used to open additional connections to other database systems. This is done using the class
A connection name from the column DBCON can be passed to the method GET_CONNECTION of this class. The
method attempts to establish the corresponding connection and, if successful, creates an instance on
CL_SQL_CONNECTION and returns the corresponding reference. Instances of CL_SQL_CONNECTION creating using
CREATE OBJECT represent the standard connection to the central database.
References to instances of CL_SQL_CONNECTION can be passed to the parameter CON_REF of the instance constructor of CL_SQL_STATEMENT or CL_SQL_PREPARED_STATEMENT. Instances created in this way execute their SQL statements in the database whose connection is represented by the instance of CL_SQL_CONNECTION.
The instance method CLOSE of CL_SQL_CONNECTION closes a database connection. The instance can no longer be used after this and statements that are already associated with the connection become invalid. CLOSE, however, is ignored in instances that represent the standard connection.
The class CL_SQL_CONNECTION class has further methods to handle a connection. These include the opening and closing of
The possible connections between AS ABAP and the database systems are defined in the database table DBCON. Entries in the database table DBCON can be created and modified using the DBA Cockpit tool.