> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/jdbc/transactioncommit.md).

# TransactionCommit

Commit the current transaction and persist all stored queries.

You can continue to use the transaction after a `transactionCommit()` call, but you will not be able to roll back past (before) this point since the changes are fully persisted to the database.

## Method Signature

```
TransactionCommit()
```

### Arguments

This function does not accept any arguments

## Examples

### Using TransactionCommit with TransactionRollback

This simple example shows two JDBC queries executed inside a transaction. The first query, an INSERT, is committed to the database while the second is rolled back.

```java
transaction {
    queryExecute( "INSERT INTO vehicles (id,make) VALUES (8, 'Ford' )", {}, { datasource : "carDB" } );
    transactionCommit();

    queryExecute( "UPDATE developers SET name = 'Chevrolet' WHERE id=8", {}, { datasource : "carDB" } );
    transactionRollback();
}
```

Note that the rollback cannot affect the INSERT statement, since it has already been committed ("persisted") to the database.

### Script Syntax

In this code, transactionCommit() will commit the pending transaction, which is any database queries run in the transaction block.

[Run Example](https://try.boxlang.io/?code=eJxLqrAqKUrMK05MLsnMz1Oo5uIsKaoEUZz6%2BgrJ%2BSmpCiX5CkWleUCBJFSlEMpWKTk%2FNzezRMmai7NWITmxJDlDQSMxr1IhVRNsCg5NRfk5OUmJydlgbVy1XADL1Cvw)

```java
bx:transaction {
	try {
		// code to run
		bx:transaction action="commit";
	} catch (any e) {
		bx:transaction action="rollback";
	}
}

```

## Related

* [IsInTransaction](/boxlang-language/reference/built-in-functions/jdbc/isintransaction.md)
* [IsWithinTransaction](/boxlang-language/reference/built-in-functions/jdbc/iswithintransaction.md)
* [PreserveSingleQuotes](/boxlang-language/reference/built-in-functions/jdbc/preservesinglequotes.md)
* [QueryExecute](/boxlang-language/reference/built-in-functions/jdbc/queryexecute.md)
* [TransactionRollback](/boxlang-language/reference/built-in-functions/jdbc/transactionrollback.md)
* [TransactionSetSavepoint](/boxlang-language/reference/built-in-functions/jdbc/transactionsetsavepoint.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/jdbc/transactioncommit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
