# Transactions

## Overview

A database transaction is a series of operations executed on a database, treated as a cohesive unit of work. This means that all operations within a transaction are either fully completed or not executed at all. In essence, there's no scenario where only part of the operations are carried out, ensuring data integrity. While a transaction is underway, the database may temporarily hold an inconsistent state, but upon completion or commitment, all changes are applied uniformly.

### Start transaction programmatically

You can start a transaction programmatically by using Database Manager [startTransaction](/reference/servoycore/dev-api/database-manager.md#starttransaction) method.

### Commit a transaction programmatically

You can commit a transaction programmatically by using Database Manager [commitTransaction](/reference/servoycore/dev-api/database-manager.md#committransaction) method.

### Rollback a transaction programmatically

You can rollback a transaction programmatically by using Database Manager [rollbackTransaction](/reference/servoycore/dev-api/database-manager.md#rollbacktransaction) method.

## Viewing Transactions

<div align="left"><figure><img src="/files/evvEgnGXSQYD4aM8qanl" alt=""><figcaption><p>Open transactions</p></figcaption></figure></div>

The admin page will show any open transactions. If anything at all shows up here, it is likely a problem as transactions should be only very briefly held open. Long running transactions can cause database issues, like deadlocks.

### Manually committing transactions

Here you can manually commit any transactions that are held, by clicking the green check button corresponding to each Transaction ID. This can be used to avoid database issues.

### Manually rollback transactions

Here you can manually rollback any transactions that are held, by clicking the `X` button corresponding to each Transaction ID.

{% hint style="danger" %}
DO NOT COMMIT OR ROLLBACK transactions here unless absolutely necessary. USING COMMIT CAN CAUSE DATA INCONSISTENCY, USE IT FOR TESTING PURPOSES ONLY! Using rollback is NOT necessary when the client crashes, as this will be done automatically. In general, there should NEVER BE ANY REASON AT ALL to commit or rollback client transactions here!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/guides/deploy/server-configuration/database-servers/transactions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
