hi all
I'm working in a CMP project on IBM WebSphere App. Server and WebSphere Studio App. Developer.
As you know when we work with CMP beans the container manage all resources including datasource connections, but in order to maintain my security profile (you know.. client requirements...!!), I need to specify different values for datasource's username and password.
(each user will connect with his own database username and password. It can't be a generic database user)
Is possible change the datasource parameters in run time to my CMP container ? or it only works with the values that I set it in the general container configuration.
thanks in advance
Discussions
EJB programming & troubleshooting: How to change datasource's usename and password in a CMP contain
-
How to change datasource's usename and password in a CMP contain (4 messages)
- Posted by: darcia
- Posted on: August 19 2003 15:53 EDT
Threaded Messages (4)
- How to change datasource's usename and password in a CMP contain by Ian Mitchell on August 19 2003 20:03 EDT
- How to change datasource's usename and password in a CMP contain by darcia on August 20 2003 10:12 EDT
- Differentiating users by Kenneth Wallis on August 20 2003 12:39 EDT
- Differentiating users by Ian Mitchell on August 20 2003 05:36 EDT
- Differentiating users by Kenneth Wallis on August 20 2003 12:39 EDT
-
How to change datasource's usename and password in a CMP contain[ Go to top ]
- Posted by: Ian Mitchell
- Posted on: August 19 2003 20:03 EDT
- in response to darcia
Have you tried not defining the username and password in the configuration, and instead having the app use the getConnection(String username, String password) method? -
How to change datasource's usename and password in a CMP contain[ Go to top ]
- Posted by: darcia
- Posted on: August 20 2003 10:12 EDT
- in response to darcia
I think that you wrote me about a code like this:
--------------------------
DatabaseResources dbResources = DatabaseResources.getInstance() ;
DataSource dataSource = dbResources.getDataSource() ;
connection = dataSource.getConnection( userID, password ) ;
-------------------------
but, did you used this code with CMP beans ?
thanks for advise me -
Differentiating users[ Go to top ]
- Posted by: Kenneth Wallis
- Posted on: August 20 2003 12:39 EDT
- in response to darcia
Can't use this type of code with a CMP. The container is responsible for obtaining and managing the data source connection. To utilize this style of programming you need to switch to a BMP.
Why can't you allow the container to utilize a generic connection and configure the EJB's security to identify individual users? -
Differentiating users[ Go to top ]
- Posted by: Ian Mitchell
- Posted on: August 20 2003 17:36 EDT
- in response to Kenneth Wallis
Admittedly I haven't tesed this at all, but I was thinking more along the lines of having the bean get a new connection...perhaps something like:
InitialContext ctx = new InitialContext();
DataSource dataSource = (DataSource)ctx.lookup(jndiName);
Connection con = dataSource.getConnection(username, password);
// use the connection
con.close();