>Hi. You should be able to get a pooled connection from one of our DataSources, >without specifying the user and password, and if you get an exception, post it >to the ejb group to find out what's wrong. Regarding the authentication of the >user, you may have an issue that needs to be addressed in the product, so post >about that too. We currently (automatically) enact security based on the >identity of the WebLogic user. >Joe > Oups ! Sorry, and forget my last email... ;-) Yes, I am able to get a pooled connection from one of a weblogic datasource without specifying a database account. My question is what's the tag <res-auth> for if my EJB is not able to authenticate the connection from a datasource when I put the value "Application" ? A). Enterprise JavaBeans� Specification, v1.1, p. 212 : "The Bean Provider has two choices with respect to dealing with associating a principal with the resource manager access: � Allow the Deployer to set up principal mapping or resource manager sign-on information. In this case, the enterprise bean code invokes a resource manager connection factory method that has no security-related parameters. � Sign on to the resource manager from the bean code. In this case, the enterprise bean invokes the appropriate resource manager connection factory method that takes the sign-on information as method parameters. The Bean Provider uses the res-auth deployment descriptor element to indicate which of the two resource manager authentication approaches is used." B). Enterprise JavaBeans� Specification, v1.1, p. 215 : "If the Bean Provider set the res-auth of a resource manager connection factory reference to Application, the Container must allow the bean to perform explicit programmatic sign-on using the resource manager�s API." Peter tries to give me some clues (http://www.weblogic.com/docs51/examples/security/acl/Package-examples.secur ity.acl.html) to define a new weblogic user, but I don't think this information correspond to my problem. Yes, I will need to define several J2EE role, that correspond to declared weblogic user, but I will need to code the relation between this new weblogic user and getting a connection from a data source, connected to a pool, that corresponds to this user. I have a solution to my problem, but I don't like it : I create as many connection pools than there are J2EE roles. I create as many datasource than connection pools. Then my EJB gets the J2EE role of the caller, selects the corresponding data source and returns to the caller a connection from this data source. I would prefer to have an only data source connected to a connection pool, and my EJB define the database account to use when it tries to get a connection from this data source. But I begin to think that what I say is a nonsense... ;-) Regards, Daniel -----Message d'origine----- De : Joe Weinstein [mailto:[EMAIL PROTECTED]] Envoyé : lundi 15 janvier 2001 19:02 À : Daniel Caune Objet : RE: Use login name and password to obtain a database connection At 10:16 AM 1/15/01 +0100, you wrote: >I'm confused, because I though if I set the tag <res-auth> of my resource >reference to "Application", my EJB will be responsible to authenticate the >connection, as I have read it in "Enterprise Java Beans, Richard >Monson-Haefel, O'Reilly" (p.371). > >But, on another hand, I was surprised that I would be able to define this >authentication while my connection pool was using another database >account... > >weblogic.jdbc.connectionPool.gamezillaConnectionPool=\ > ... > props=user=myUser;password=myPassword; > >So, this points seems to be ambigous for me : if I can't define a datasource >from a connection pool without giving a database account (weblogic raises an >exception), when the value Application of the tag <res-auth> can be used ? > >My goal is to develop an EJB that provides a database connection from a pool >according to the J2EE role of the caller (I have an alias map between J2EE >roles and database accounts). This is the reason why I want to authenticate >myself the connection to database. > >How could I do this? Hi. You should be able to get a pooled connection from one of our DataSources, without specifying the user and password, and if you get an exception, post it to the ejb group to find out what's wrong. Regarding the authentication of the user, you may have an issue that needs to be addressed in the product, so post about that too. We currently (automatically) enact security based on the identity of the WebLogic user. Joe > >Regards > > >Daniel > > >-----Message d'origine----- >De : Joseph Weinstein [mailto:[EMAIL PROTECTED]] >Envoyé : vendredi 12 janvier 2001 19:35 >À : Daniel CAUNE >Objet : Re: Use login name and password to obtain a database connection > > > > >Daniel CAUNE wrote: >> >> Hi, >> >> Just another question. In my EJB, I try to use a login name and a password >> to obtain a database connection (from a datasource connecting to a >> connection pool - WebLogic 5.1, Oracle JDBC thin driver) : >> >> ---------- >> initialContext = new InitialContext (); >> dataSource = (DataSource) initialContext.lookup >> (java:comp/env/jdbc/gamezillaDataSource); >> return dataSource.getConnection (databaseAccountUserName, >> databaseAccountPassword); >> >> // return dataSource.getConnection (); /* This one works very fine */ >> ---------- >> >> The last insruction raises an exception "getConnection(user,password) not >> implemented" !... Really ??? > >Yes. Because you're getting an already-made connection from a pool, there's >no use for a user name or password. >Joe > >> >> ---------- >> ven. janv. 12 17:03:32 GMT+01:00 2001:<I> <EJB JAR deployment >> >G:/PrivateWorkspaces/Danielc/5-SubProjects/CoreServices/5-Products/bin/Conn e >> ctionFactoryEJB.jar> Exception in non-transactional EJB invoke: >> javax.ejb.EJBException: getConnection(user,password) not implemented >> at >> >com.infusio.gamezilla.util.ConnectionFactoryBean.getConnection(ConnectionFa c >> toryBean.java:171) >> at >> >com.infusio.gamezilla.util.ConnectionFactoryBeanEOImpl.getConnection(Connec t >> ionFactoryBeanEOImpl.java:56) >> at >> >com.infusio.gamezilla.util.ConnectionFactoryBeanEOImpl_ServiceStub.getConne c >> tion(ConnectionFactoryBeanEOImpl_ServiceStub.java, Compiled Code) >> at >> >com.infusio.gamezilla.util.ConnectionFactoryWrapper.getConnection(Connectio n >> FactoryWrapper.java:56) >> at >> >com.infusio.gamezilla.playercenter.PlayerAttributeClassBean.getAllAttribute C >> lasses(PlayerAttributeClassBean.java, Compiled Code) >> at >> >com.infusio.gamezilla.playercenter.PlayerAttributeClassBeanEOImpl.getAllAtt r >> ibuteClasses(PlayerAttributeClassBeanEOImpl.java:101) >> at >> >com.infusio.gamezilla.playercenter.PlayerAttributeClassBeanEOImpl_WLSkel.in v >> oke(PlayerAttributeClassBeanEOImpl_WLSkel.java:103) >> at >> >weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAd a >> pter.java, Compiled Code) >> at >> >weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandl e >> r.java:69) >> at >> >weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java: 1 >> 5) >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code) >> ---------- >> >> The properties of my connection pool and my datasource are as follows: >> ---------- >> weblogic.jdbc.connectionPool.gamezillaConnectionPool=\ >> url=jdbc:oracle:thin:@E420R:1521:GZDEV,\ >> driver=oracle.jdbc.driver.OracleDriver,\ >> loginDelaySecs=1,\ >> initialCapacity=4,\ >> maxCapacity=10,\ >> capacityIncrement=2,\ >> allowShrinking=true,\ >> shrinkPeriodMins=15,\ >> refreshMinutes=10,\ >> testTable=dual,\ >> props=user=myUser;password=myPassword; >> >> >weblogic.allow.reserve.weblogic.jdbc.connectionPool.gamezillaConnectionPool = >> everyone >> weblogic.jdbc.TXDataSource.gamezillaDataSource=gamezillaConnectionPool >> ---------- >> >> The deployment file of my EJB that uses the connection factory is as >below: >> ---------- >> ... >> <resource-ref> >> <description>Connection pool to GameZilla database.</description> >> <res-ref-name>jdbc/gamezillaDataSource</res-ref-name> >> <res-type>javax.sql.DataSource</res-type> >> <res-auth>Application</res-auth> >> </resource-ref> >> ... >> ---------- > >-- > >PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advanced >positions >for people who want to work with Java, XML, SOAP and E-Commerce >infrastructure products. >We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San Jose CA. >Send resumes to [EMAIL PROTECTED] > > PS: Folks: BEA WebLogic is in S.F. with both entry and advanced positions for people who want to work with Java, XML, SOAP and E-Commerce infrastructure products. Send resumes to [EMAIL PROTECTED] ---------------------------------------------------------------------------- ---- JavaWorld Editor's Choice Award: Best Web Application Server Java Developer's Journal Editor's Choice Award: Best Web Application Server Crossroads A-List Award: Rapid Application Development Tools for Java Intelligent Enterprise RealWare: Best Application Using a Component Architecture http://www.bea.com/press/awards_weblogic.html =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
