I wrote a small mbean. I need to access Database in this mbean. (may be I shouldn't? use a session/entity bean?) I tried usual conext.lookup ("java:/DefaultDS"); and it seems to work fine except for the fact that I have to specify user name and password in ds.getConnection () method.
In servlets/entityB/session bean I could specify <res-auth>Container</res-auth> in the deployment descriptor and the container took care of auth.