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?
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/Conne
> ctionFactoryEJB.jar> Exception in non-transactional EJB invoke:
> javax.ejb.EJBException: getConnection(user,password) not implemented
> at
>
com.infusio.gamezilla.util.ConnectionFactoryBean.getConnection(ConnectionFac
> toryBean.java:171)
> at
>
com.infusio.gamezilla.util.ConnectionFactoryBeanEOImpl.getConnection(Connect
> ionFactoryBeanEOImpl.java:56)
> at
>
com.infusio.gamezilla.util.ConnectionFactoryBeanEOImpl_ServiceStub.getConnec
> tion(ConnectionFactoryBeanEOImpl_ServiceStub.java, Compiled Code)
> at
>
com.infusio.gamezilla.util.ConnectionFactoryWrapper.getConnection(Connection
> FactoryWrapper.java:56)
> at
>
com.infusio.gamezilla.playercenter.PlayerAttributeClassBean.getAllAttributeC
> lasses(PlayerAttributeClassBean.java, Compiled Code)
> at
>
com.infusio.gamezilla.playercenter.PlayerAttributeClassBeanEOImpl.getAllAttr
> ibuteClasses(PlayerAttributeClassBeanEOImpl.java:101)
> at
>
com.infusio.gamezilla.playercenter.PlayerAttributeClassBeanEOImpl_WLSkel.inv
> oke(PlayerAttributeClassBeanEOImpl_WLSkel.java:103)
> at
>
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAda
> pter.java, Compiled Code)
> at
>
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandle
> 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]
===========================================================================
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".