Re: [JBoss-user] RE: (JBoss-user) RE: (JBoss-user) Oracle Authentication

2001-04-07 Thread Toby Allsopp

Greg Parker wrote:

 Sorry, I didn't intend to sound like such a dork.

:-) Happens to us all at some point.

 Here is what I was getting at
 In a previous note you suggested two approaches:
 
 - 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.
 
 We will potentially have 150 to 200 users to start with. Would this be an
 acceptable approach? And if so, how do I configure jboss.jcml to handle this.

Probably not. You could have some way of generating your jboss.jcml from
a list of users, but that seems kind of horrible. I think you probably
want to stay away from this.

You should be able to create pools at runtime using JMX. You could write
an MBean that reads in a list of users and passwords and creates a
connection pool for each.

 - don't use connection pools, i.e. create a new JDBC connection every time
 
 Doesn't this defeat some of the purpose behind using EJB's and jboss?

Yes, you probably want to stay away from this as well.

Probably (I use that word a lot) the best solution is one of:

- fix the Minerva JDBC connection pools to take into account the
  username/password when giving out connections (see the conversation
  with Guy about this)

- use the JCA-based JDBC connection pools. This is inconvenient because
  you need to manually deploy the resource adapter at the moment (you
  could write an MBean to do this for you at startup.)

Toby.


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



[JBoss-user] RE: (JBoss-user) Oracle Authentication

2001-04-06 Thread Greg Parker

Thank you for your assistance.
I want to make sure I understand the implications of this.
If going I'm to establish my own connection string within the bean, this implies
that I will be writing my own SQL code to go with it. Does this imply I can not
implement CMP, only BMP or Session beans?

Thank you,
Greg Parker


 -Original Message-
From:  [EMAIL PROTECTED] at Internet
Sent: Friday, April 06, 2001 5:46 PM
To: [EMAIL PROTECTED] at Internet
Subject: RE: [JBoss-user] Oracle Authentication

  File: RFC822.TXT  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



Re: [JBoss-user] RE: (JBoss-user) Oracle Authentication

2001-04-06 Thread Guy Rouillier

See the discussion Toby and I are having - probably not feasible for CMP
(though I haven't done enough with CMP to say authoritatively.)

- Original Message -
From: "Greg Parker" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 06, 2001 11:02 AM
Subject: [JBoss-user] RE: (JBoss-user) Oracle Authentication


 Thank you for your assistance.
 I want to make sure I understand the implications of this.
 If going I'm to establish my own connection string within the bean, this
implies
 that I will be writing my own SQL code to go with it. Does this imply I
can not
 implement CMP, only BMP or Session beans?

 Thank you,
 Greg Parker


  -Original Message-
 From:  [EMAIL PROTECTED] at Internet
 Sent: Friday, April 06, 2001 5:46 PM
 To: [EMAIL PROTECTED] at Internet
 Subject: RE: [JBoss-user] Oracle Authentication

   File: RFC822.TXT  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



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



Re: [JBoss-user] RE: (JBoss-user) Oracle Authentication

2001-04-06 Thread Toby Allsopp

Greg Parker wrote:

 Thank you for your assistance.
 I want to make sure I understand the implications of this.
 If going I'm to establish my own connection string within the bean, this implies
 that I will be writing my own SQL code to go with it. Does this imply I can not
 implement CMP, only BMP or Session beans?

Well, yes... Writing your own SQL code means that, by defintion, you are
not using CMP.

If you want to have per-user connections with CMP then you will need to
implement a principal mapping for JBossCX as I mentioned before.

Toby.


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