Set up a remote database connection with a Store and Forward

Hello,

I come to ask for help to understand how to set up a remote database connection with a Store and Forward.

Let me explain: I have a local and a remote database. My goal is to be able to exchange data between these two databases. The local database will send all its data to the remote database and the remote database will send only some data to the local database.

I have seen the videos on the Store and Forward principle and on the connection of the databases but I can't see how to articulate these elements to achieve the results described above.

I hope you could help me to understand or explain me if I misunderstood one of the concepts. Thanks !

The store and forward system doesn't connect two database like you presume. It merely provides gateway-local buffering between a single database connection and various generators of database records. Like the historian, the SQL Bridge module's transaction groups, or deliberate script calls. It has no DB to DB replication functionality at all. That sort of thing is left to the user, or to functionality at the DBs themselves.

Okay, that's what I wanted to see. So, I would have to use Store and Forward to store in my local database and then use a script that would share the data to my remote database and vice versa, in your opinion?

For small amounts of data, scripting is not unreasonable. But you say you want everything in the local DB replicated. Consider using your DB's replication technology to mirror your local DB into a read-only remote DB. Use a completely separate DB for the other direction. Or, perhaps, make a separate connection to that remote DB for Ignition to access on demand.

Thanks for the advice. I'll try to create a separate connection to this remote database so that Ignition can access it on demand because the other solution you propose here doesn't work for me because the remote database becomes the local one and the local database becomes the remote one (I forgot to specify but it will depend on where the manipulations are done).

Otherwise, I just thought I could define the remote database in the local database set for the local project and set it with the appropriate address. Then, when declaring the Named Query I could perform the queries in both databases at the same time?

Not sure an NQ will allow that. But you would be setting a complexity trap that will screw anyone who follows behind you.

Perhaps you can share more about your constraints.

Yes, to give more context: I have different databases for several sites (the local databases) and one database for the "parent" site (the remote database). The local sites only have access to the data in their database but the parent site has access to all the data regardless of the site. However, the data must be synchronized regularly and it is possible to establish requests from the parent site to another site.

That's why I was thinking that establishing the query in both databases would not be a problem because the databases must be synchronized?

Hmm. If using the tag historian, consider using the Tag History Splitter. You should script the rest.

Note that you can use a special parameter with named queries to select what DB connection to use at runtime, then you could call the NQ twice, once for each DB.

1 Like