Toby, I haven't taken the time to dig into the minerva code.  Realistically,
how far away are we from JCA?  It shouldn't take long to update minerva so
that it uses the userid to get a connection for that userid (I'm thinking of
a hash) - I could take a crack at that.  But if JCA is right around the
corner, then it may not be worth the effort.  Just curious - I see the
userid and password being passed on to the factory - are you sure the
pool.getObject()).getConnection() doesn't cause the factory to use the
userid and password?

I thought a  little more about my scenario.  Perhaps the reason if fails on
the first attempt is that it is using the connection already in the pool
(although, because I don't have a userid or password in the MBean, that
connection is pretty worthless.)  Then when the first call fails, perhaps
the connection is discarded, so that the second call through causes the
factory to generate a new connection with the userid and password given to
it, and everything works after that.

----- Original Message -----
From: "Toby Allsopp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 06, 2001 1:46 AM
Subject: Re: [JBoss-user] Oracle Authentication


> Guy Rouillier wrote:
>
> > I think J2EE (and JBoss) handle this, though I may have found a bug in
>
> You are quite right that the spec allows this. Apologies for the
> misinformation.
>
> The relevent section of the EJB2.0 spec that I have is 19.4.
>
> > JBoss.  In jboss.jcml, when you create your connection pool, provide a
URL
> > but do not provide a userid or password.  The MBean will start up
> > successfully.  In your bean code, use this form of connect statement:
> >
> >    Connection connection = ((DataSource)new
> >
InitialContext().lookup("java:comp/env/jdbc/OracleDB")).getConnection("myuse
> > rid", "mypassword");
> >
> > Now your connection will use the credentials of the userid provided.
I've
> > tried this and it seems to work
>
> Now, JBoss's support of this is obtained from Minerva. Looking at the
> code for XAPoolDataSource, we see:
>
>     /**
>      * Gets a new connection from the pool.  If a new connection must be
>      * created, it will use the specified user name and password.  If
there is
>      * a connection available in the pool, it will be used, regardless of
the
>      * user name and password use to created it initially.
>      */
>     public Connection getConnection(String user, String password) throws
java.sql.SQLException {
>         if(!initialized) initialize();
>         factory.setUser(user);
>         factory.setPassword(password);
>         return ((XAConnection)pool.getObject()).getConnection();
>     }
>
> So, Minerva does not do what you might expect, unless you are never
> returning your connections to the pool.
>
> This is superceded by the JCA stuff, which knows how to handle the case
> of requesting connections on behalf of different principals.
>
> Toby.
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to