I think J2EE (and JBoss) handle this, though I may have found a bug in
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
BUT...
I see some odd behavior. If I define the MBean in jboss.jcml and include a
userid and password, i.e.
<attribute name="JDBCUser">auserid</attribute>
<attribute name="Password">apassword</attribute>
then everything works as expected. However, if I define the MBean without
the above two entries, JBoss starts up fine and creates the connection pool.
I can deploy the EJB fine with no errors. But when I run the code with the
above connection, I get an exception stating "table or view does not exist".
But if I then immediately rerun the client a second time, it succeeds. So
there seems to be a bug in JBoss here. It doesn't pick up the new
credentials until the second attempt.
----- Original Message -----
From: "Toby Allsopp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 9:34 PM
Subject: Re: [JBoss-user] Oracle Authentication
> On Thu, Apr 05, 2001 at 05:07:24PM -0700, Greg Parker wrote:
> > Hello All
> > I'm newbie with JBOSS.
> > I need users to be able to login and authenticate themselves as a user
> > into our Oracle database. So that their session and connection to Oracle
> > is with their own personal ID. It seems that when the JBOSS server
> > starts, it connects to Oracle with whatever JDBCUser and password is
> > specified in the jboss.jcml file. Therefore, if I have a trigger in my
> > Oracle database which inserts a userid into a record, it inserts the
> > JDBCUser that is specified in the jboss.jcml file. I need the trigger to
> > recognize who the user is that has opened that connection and insert
> > their userid not the JDBCUser.
> >
> > How do I connect and create as session to our Oracle database through
> > jboss, using a personal ID and password?
>
> Hi.
>
> This is something that is not easy to do in the current version of J2EE.
> You have a couple of options:
>
> - have a separate connection pool for each user
> Depending on the number of users you have, it might be sufficient to
> set up the pools in jboss.jcml, or you might want to do it
programmatically
> using JMX at runtime.
>
> - don't use connection pools, i.e. create a new JDBC connection every time
>
> In the future, the way to do this will be using the J2EE Connector
> Architecture. You can probably do this using the current JCA support in
> JBoss, but you'll need to write some code.
>
> Look at org.jboss.resource.security.* in the jbosscx cvs module and it
> should be apparent that you can write a OneToOnePrincipalMapping class
> to do what you desire.
>
> Let me know if you decide to do this and you want any help.
>
> 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