• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

difference between datasource and transcation datasource in ejb

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When do we use non-transactional datasources?
 
Poop goes in a willow feeder. Wipe with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic