sapdev logo background
sapdev logo sapdev logo
Comments

SAP CL SQL CONNECTION documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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
  • CL_SQL_CONNECTION

  • 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
  • database LUWs


  • Note
    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.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    CL_ABAP_WEAK_REFERENCE
    CL_SQL_PREPARED_STATEMENT




    comments powered by Disqus