Hi everyone!
I'm currently building an application for a client where there are 2 database connections. The database used is SQL Server 2014 and we're using the SqlSrvPDO extension wrapped in a DAL that I have created. So far there have been no issues as my research discovered that as long as the 2 databases are on the same server and the user has the correct permissions for both, you can explicitly specify the database in your queries for the second database, even though the DB object was created with the first.
This was fine up until about 10 minutes ago when the client revealed that in production the databases my be on different servers (they didn't tell me this prior, and up to this point their production environment has always mirrored their QA environment). So now I have to review my code where the database is concerned which is no cakewalk. What are the tips and best practices for this sort of scenario? Should I simply be passing two database objects to my classes as a safety measure instead of just the one?
The first database is being used to simply select data. This is the one that is being used to created the database object and passed to PDO. The second is where some data will be inserted and selected, but only in certain scenarios.
Thanks for any help!