• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC in Servlets or EJB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have done certification in java web component development and now trying to work on the databases.
Someone told me that in java the databases can be retrieved and updated more properly in EJB as compare to Servlets.
Can someone tell me is there any difference between the two while working on the databases. Is there any performance issue.

Thanx
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shaf,

One of the things for sure is the Transaction support that EJB provides.

Relating to your concern, which is database, EJB provides ACID support that makes your data consistent.

Although there are other frameworks that can help you mimick the capability, such as Hibernate.

Cheers!
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

omeone told me that in java the databases can be retrieved and updated more properly in EJB as compare to Servlets.

you can use an EJB inside a servlet or use plain JDBC from within a Servlet , so these two are different stuff. servlet is in use for processing request that comes across the web and EJB is an standard for Persistance mechanism.
Indeed you can access to database from servlet by means of both ORM frameworks like Hibernate ,Ibatis, .... and Also by means of Entity beans that is Standard way and is discussed very widely..


Can someone tell me is there any difference between the two while working on the databases. Is there any performance issue.


different is that you will need more knowledge of Entity beans to write an application that use EJBs as persistance mechanism.
usually we use EJBs when we need some certain features like .
application must be work in distributed Env.
application should handle very larg amuont of transaction.
application should communicate with both web front end and Swing front end (both communicate with sesion beans or Entitie directly)
....

So , if you are new to Java database , i suggest you go with plain JDBC to access you data.
reply
    Bookmark Topic Watch Topic
  • New Topic