views:

92

answers:

2

I've deployed a web-module which connects to the database via a datasource configured in the J2EE application server.

Currently, the user/password for the database connection is set in the proper J2EE application server's datasources configuration file.

I want to change during runtime the datasource's user/password. (e.g.: implement a new web form in which the user is asked to enter de user/password to be used in the database connection).

Is there a standard way to do that in J2EE applications or it depends on the J2EE application server? In this case I'm using Orion application server.

+1  A: 

DataSource has a getConnection method that takes a username and password. That seems to be what you are looking for.

Yishai
A: 

The management of data sources is not standardized. You have to use your AS' API, if it provides any for this a bit unusual use case.

Jakub Holý