Ansicht
Dokumentation

ABENDB_CONNECTIONS_TRANS - DB CONNECTIONS TRANS

ABENDB_CONNECTIONS_TRANS - DB CONNECTIONS TRANS

General Data in Customer Master   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

Database Connections and Transactions

Every active database connection creates a separate transaction context or is linked with its own database LUW. This means that database changes on one connection can be committed or rolled back independently of changes on other database connections. In this way, for example, log data can be stored in and committed on a secondary connection without modifying the database LUW of the standard connection.

Database changes can be committed or rolled back as follows specifically for database connections:

  • When a database connection is made inactive implicitly at the end of an internal session, a database commit is triggered.
  • When a database connection is closed explicitly in Native SQL, a database rollback is triggered.

In addition, there are the statements COMMIT WORK and ROLLBACK WORK, as well as the implicit database commits and database rollbacks, that act on all active connections.

A secondary connection or service connection is always set to inactive when its database changes are committed or rolled back. A connection deactivated in this way can, however, still be used in the same internal session without being opened explicitly, not just in , but also in Native SQL or AMDP. The first time an inactive secondary connection or service connection previously active in the current internal session is reused, it is made active again and a new database LUW is opened.

Warning

Extreme care must be taken when using SQL SET TRANSACTION statements to set the transaction behavior of the current database connection. The transaction behavior set using these statements is preserved across the entire current database LUW, which can cause unexpected or critical situations when the database connection is reused. The default behavior of the transactions must be restored before the end of the database LUW. When the SAP HANA database is accessed, special methods must be called for setting the transaction behavior instead of using the SQL SET TRANSACTION statements directly. In this case, the default transaction behavior is restored automatically at the end of the database LUW. No automatic resets can currently be performed for other database platforms.

Notes

  • All , Native SQL, and AMDP reads made on a shared active database connection of an internal session work in the same database LUW.
  • The static Native SQL statement SET CONNECTION is ignored by the database LUWs of the connections involved.
  • Secondary connections and service connections in an internal session cannot be used in called programs, which means that a called program always activates its own connection and hence its own database LUW, even if the same connection name is used.
  • Secondary connections, more specifically service connections, can be used to implement independent database LUWs on a secondary database or on the standard database. Care must be taken to avoid lock situations here.
  • Working with multiple database connections, namely independent database LUWs, can produce lock situations in which only one work process is involved: a program changes a database row on the first connection and tries to change the same row on a second connection. This results in the program waiting for the lock of the first database LUW, without this first LUW ever being able to continue. This situation can only be resolved by ending the work process. This is done automatically for dialog processes, but it must be done manually for background jobs. It is therefore not advisable to change the same table within the a single program using multiple database connections.

Example

If the statement COMMIT CONNECTION default were not used, the following program section would produce a lock situation because the standard connection ( here) and a service connection (Native SQL here) would be used in independent database LUWs to access the same row of a database table.






BAL_S_LOG - Application Log: Log header data   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 6694 Date: 20240426 Time: 111859     sap01-206 ( 111 ms )