How can I connect to multiple databases which are non-identical on the fly (loading the type and connection info of the DB from my DB) using Spring?
what I am trying to build?
I am building a Spring-Boot application that should be able to get data from my customers in the following ways:
1. Connect to my customer SQL DB (MySQL, MSSQL, PostgreSQL,etc...)
2. connect to my customer MongoDB,
3. read data from CSV/JSON files.
While the app is running it gets an HTTP request with customer id. to connect to. at this point, the app should load this customer from my DB (that contain exactly what DB he's using and the credentials to connect to it) and should init a connection to this DB to be able to start query it. (DB Schemas are different between 1 customer to another so I also maintain a set of queries in my DB to query the customer)
I'm struggling to implement the blue part of the diagram:
DataSource
bean programmatically when your application is starting up. You can find more information here. If it is not what you want to achieve please add some kind of sequence diagram. – Lullaby