What are examples of non-transactional data sources?

The JBoss Documentation has the option to declare <no-tx-datasource> , which states:

no-tx-datasource . This element is used to indicate the configuration of the service (org.jboss.resource.connectionmanager) NoTxConnectionManager. NoTxConnectionManager is a JCA non-transactional connection manager.

I'm curious what could be connected with this data source? Ldap? What are practical use cases or open source examples of this type of configuration?

+4
source share
2 answers

Read-only access to the database is the easiest use case I can think of. Another option would be an application that controls the state of a transaction. And one more thing if you want to use a connection that will not participate in the global JTA transaction. The latter occurs in Quartz (see JobStoreCMT ).

But, while googling (this is a good question!), I found more inspiration in the section Using Non-Transactional Connections Sun Server Documentation:

The main advantage of using non-transactional connections is that the costs associated with attracting and disconnecting connections in transactional contexts are eliminated. However, use these connections carefully. For example, if a non-transactional connection is used to query the database during a transaction that modifies the database, the query retrieves the unchanged data in the database. This is because the transaction is not executing. In another example, if it is not a transactional connection that modifies the database, but a transaction that is running at the same time is rolled back, changes made by a non-transactional connection are not rolled back.

Here is a typical use case for a non-transactional connection: a component that updates the database in the context of a transaction that spans several iterations of a loop can update cached data using a non-transactional connection to read data before the transaction commits.

Interesting...

+5
source

Not all dataSources are tx, a DataSource can also represent a file on disk.

0
source

All Articles