Hi,
We have a
J2EE application deployed on JBoss-3.2.3. We have deployed a datasource for the same. We have a requirement that given a username/password, we have to validate that this is a valid database user/password. Currently, the way we have implemented this is:
- Lookup the DataSource object
- Invoke the getConnection(user,password) method on the DataSource object
- If SQLException is thrown then display error message. Else, validation succeeds.
Issues that the current implementation has:
- getConnection is a heavy operation.
- SQLException is caught, and irrespective of whether the exception is because of invalid user/password(exception might have occured for some other reason), its assumed that user/password is invalid.
Is there any light weight operation through which, given a username and password, it can be validated that this user/password is valid database user/password?