aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes difference between datasource and transcation datasource in ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "difference between datasource and transcation datasource in ejb" Watch "difference between datasource and transcation datasource in ejb" New topic
Author

difference between datasource and transcation datasource in ejb

Ramamoorthy
Greenhorn

Joined: Mar 13, 2001
Posts: 19
Hi,
can you tell the difference between data source and transcation data source and in what conditions we should use them?
Ram
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi,
Using Weblogic 7.0,
When U define a CMP Entity Bean, u use TX Datasource and
when u define a BMP Entity Bean, u use the DataSource in the code defined in any method accessing the Database using the following syntax.
private Connection getConnection() throws SQLException
{ InitialContext initCtx = null;
try
{
initCtx = new InitialContext();
DataSource ds = (javax.sql.DataSource)initCtx.lookup("orasource");
return ds.getConnection();
}
............
}
HTH,
Seetesh
Matt Warsaw
Greenhorn

Joined: Apr 22, 2004
Posts: 1
Always Use A Transactional Datasource for Container-Managed EJBs
If you configure a JDBC datasource factory for use with container-managed EJBs, make sure you configure a transactional datasource (TXDataSource) rather than a non-transactional datasource (DataSource).
With a non-transactional datasource, the JDBC connection operates in auto commit mode, committing each insert and update operation to the database immediately, rather than as part of a container-managed transaction.
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 177
Most data sources are transactional. In essence, a database operation that does an updaqte executes in autom-commit mode which is a transaction with a single operation.
So when you do a query (without a for update), it is not a transaction?
Perhaps you mean what is the difference between an XA and NONXA data source?


Roland Barcia<br />STSM - ISSW Lead Web 2.0 Architect
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
When do we use non-transactional datasources?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: difference between datasource and transcation datasource in ejb
 
Similar Threads
Question about JDBC/DATASOURCE/TXDATASOURCE
Data Source Vs Transaction Data Source
DataSource and ConnectionPool
Transcation basic
difference between XADatasourca and non-xa datasource