I have a web application which connects to an Oracle database. The application is now going to have a new set of users. A new db is being planned for this new set of users. Is it possible to connect to the appropriate db based on the user who logs in. As of now the database configuration is done through JNDIName entry in an xml file.
I have a web application which connects to an Oracle database. The application is
Share
Absolutely. For a given DAO class (assuming you’re using DAOs), create two bean definitions, one for each database, and then pick which DAO bean you want to use in your business logic:
Where
dao1anddao2are theDataSourcebeans representing your two different databases.At runtime, your business logic selects
dao1ordao2appropriately.