I am working on an application which is largely dependent on another application's DB. So I was wondering should I create two database connections or run a Cron job on the servers to sync my databases?
My research says that I can have multiple connections but it will slow down the requests.
Thanks in advance
It's not good to rely on other's application DB. It can change eventually and nobody will tell you about it.
It's better to make API (REST, RPC, Queues, whatever) that should be working as promised. Even if DB changes, they can keep API format so you don't have to rewrite your application.
But API may be harder to implement. You can consider DB as unstable unreliable API and use it directly. If you need only read-only access make new DB user that has only read-only access.
Also if DB is at other host be prepared to:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.