This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between datasource and transcation datasource in ejb  RSS feed

 
Ramamoorthy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When do we use non-transactional datasources?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!