Problem description
I have 6 databases from 6 different machines, and having one cloud server. It will decided at the time of user login that which database is going to use in application.
I am able to connect with single database. But I have no idea to handle dynamic names of databases.
Update:
I am able to change databases dynamically, but one problem is going on. There are some stored procedures in only one database that is common (placed at cloud server), (I have restriction where I can’t add stored procedures to all databases), so I am not able to call stored procedures for any other databases. How can I call?
Please give me some ideas.
In Spring there is a class called
AbstractRoutingDataSourcewhich will suites for your requirement, Go through the documentation you will find some help on how to implement a concrete class of this, You need to change(or add) some part of you existing code in order to configure the dynamicData source. This blog from spring source is explaining this in action.