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.