I want to implement a functionality where I want to change the database based on the user selected company.
For example:
When User A
visit my site he needs to login, after the login he can search his company, until this point I am connecting the user to my server db; after he search his company and press the done button I have to make a connection to his server and dynamically change my server db to his company server db. (the reason of doing this is my web app is gonna used by multiple companies so companies gonna have different employee records so i have to connect to db of their server to get their employers records).
I am really confused how to achieve this what data I need to store in my db for making connection to different server db?
As far I researched I understood that I need to store the dbname,dbusername,dbPassword
.
Do i need to store anything else? Do I need to store the host name too? Can any of you guide me how to achieve this?