• 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:

transaction in ejb vs jdbc

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a guideline is to use ejb if you are using transactions but i could do transactions without ejb by just using jdbc. what is the difference?
are they the same when i connect to just one transaction aware system (such as an oracle database)?
does the difference come into play when i want a transaction to span multiple transaction aware systems like oracle and db2?
 
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a bean that engages in a transaction. You can more easily port it from system to system than a sequence based on a jdbc routine.
JDBC does not support a transaction involving a JMS data source.
You could wrap a legacy system with a bean managed transaction that jdbc would not be able to deal with.
 
tom walters
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ejb transaction can span more than just databases, while jdbc is limited to db transactions. how about when all we are dealing with is databases?
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on the database and the JDBC drivers available. You mention Oracle to DB2 above, that should work just fine.
Database to database transactions are called something like distributed transactions or two phase commits.
Some influential entities in the consulting world think an EJB solution is often overkill. Security is the other great attribute of EJB systems according to Monson-Haefel.
HTH
 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like impossible to relate two sort of Database in one trasaction by using JDBC only, at least you have to use the JTA explicitly in your code to support the two phase commit transaction. But if you're going to use EJB, they are handled by container.
Lipman
SCJP2
SCJD2
SCEA
[ August 25, 2002: Message edited by: Lipman Li ]
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by tom walters:
a guideline is to use ejb if you are using transactions but i could do transactions without ejb by just using jdbc. what is the difference?
I suppose developers are not required to take care about the transactions management,access control or mulithreading,concurrenncy etc.
So as said earlier it depends on the requirement of the particular application.
But one thing is sure that we should avoid overkilling of technologies like EJB.
are they the same when i connect to just one transaction aware system (such as an oracle database)?
Replied above.
does the difference come into play when i want a transaction to span multiple transaction aware systems like oracle and db2?


EJB internally uses JTA to manage the transactions.So if u want to do it ur self the as suggested earlier u need to explicitely code JTA which could be again application specific.
-Yogesh
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic