the problem that I have now been told that database1 is on another server
I would ask myself three questions to find the best solution:
(A). If it is not mandatory that the two BDs are separated
If it is not, it would be best to have the two BDs on the same server, because you avoid that your site depends on another domain . Suppose the domain where the other BD is is down, does not work for a few hours or a day, or is hacked ... The parts of your domain that show data from that "external" DB would not work, maybe many pages of your web be shown blank.
If there is no other output and the DBs must be on different servers, then there are several possibilities to call the data from your "external" DB. The safest thing, I think, would be to consult said "external" DB in the form of an API. You would consult URLs of the same that would return the values you need in JSON format and present these formats on your page. But ... for that you must have access to the other domain and program your API to return the data you need.
(B). If the two BDs can be in the same domain
If this is possible, excellent! It would be a better solution than (A) . Well, you can create two connections to each BD, as explained in previous responses and comments. Ask each BD for the data you need and show them on your page. So you stop depending on whether the other domain works or not.
But ... I would still ask another question.
(C). If it is mandatory that the two BDs are separated
If it is not, the best thing of all would be to have a unique BD with all the tables of BD1 and BD2.
You would gain speed and efficiency on your website. Having a supplementary connection always has its price, as well as consulting two BDs instead of one. The difference is also noticeable when programming.
(D). In summary
Everything will depend on what you can or can not do in your case and how you want to use it. But, within the possibilities, choose what is most practical and most effective.