Transactions in Virtual DataPort¶
Virtual DataPort allows defining transactions, using the following clauses:
BEGIN. Begins a transaction.
COMMIT. Confirms the active transaction.
ROLLBACK. Undoes the changes made to the active transaction.
Transactions in Virtual DataPort are distributed by nature. Therefore, only data sources implementing the Two-Phase-Commit protocol can take part in them. Most database vendors implement this protocol. In addition, custom wrappers and stored procedures can also take part in transactions, provided that the necessary operations to do so are implemented.
Virtual DataPort imposes certain limits on the duration of the transactions:
- A transaction cannot last for more than 30 minutes. The transactions that last more time are rollbacked. This limit can be changed by executing this command with an administrator account:
# The command below sets the transaction timeout to an hour (3600 seconds). SET 'com.denodo.vdb.engine.session.transactionTimeout' = '3600';
A client that starts a transaction cannot be idle for more than 29 seconds. I.e. once the execution of a statement finishes, the client has to execute another statement in less than 30 seconds. Otherwise, the transaction is rollbacked.
To change this limit, execute this command with an administrator account:
# The command below sets the inactivity timeout to a minute (60 seconds). SET 'com.denodo.vdb.engine.session.inactiveTransactionTimeout' = '60';
If you do not want a data source to participate in distributed
transactions, set its source configuration property
You should use transactions only when you actually need them.
I.e. you should not surround your queries with
unless you actually need these queries to be performed inside a
transaction. The reason is that Virtual DataPort uses a distributed
transaction manager, which uses a 2-phase commit protocol. This protocol
introduces some overhead over the queries. Therefore, if you add
COMMIT without needing it, your queries will run
- To disable all the transactions received from ODBC clients, follow the steps in the section Disabling Transactions of the Developer Guide.
- To avoid a JDBC client to start a transaction inadvertently, add the parameter autoCommit=true to the connection URL or as a driver property. For example:
You can connect to the monitoring interface of the server (JMX interface) to obtain the number of active transactions. See more about this in the section Attributes of the VDBServerManagementInfo MBean of the Administration Guide.