I’ve got 2 servers at different locations and I need a secure to do this.
SERVER1 shows the latest entries for the web application on SERVER2. This app from on a subdomain so that its not on the same server as the main website for security reasons.
Problem. main site on SERVER1 pulls from the database of that web app which is now on SERVER2. I can’t do a remote SQL connection as that is too slow.
Is there an ideal way to code this or do this?
If I understand your question correctly, you are looking for a way to query the server1 database from server2, without using a remote SQL connection because it’s too slow.
Based on that, any kind of remote operation will be too slow (e.g. a SSH tunnel isn’t going to speed things since it just adds encryption to the process).
Personally, I would set up some kind of database replication – each time a record is inserted/changed/deleted on server1, that change is pushed to server2. Then you are able to query server1 as if it were local (i.e. query it on server2) where it’ll always be up-to-date and should be sufficiently fast for your needs.