0

There are 2 applications which are designed to connect to DB and a table with matching fields. The goal is to connect the 2 applications to the same database and the same table. Both applications will be selecting, inserting and updating the data. However there are some differences between the applications:

  • One is designed to connect to MySQL, the other to MariaDB.
  • The expected table name is different

The current plan is to connect both applications to MariaDb. The MariaDb application would keep functioning as before. For the MySQL application I would create a VIEW in MariaDb, which would make the data available under a different name (as the application expects). Since only CRUD operations are executed on just one table I would expect this to work without problems.

  1. Is there any other (better) way to achieve what I aim to do?
  2. Any recommendations or issues to look out for in such a setup?
Tarmo
  • 1,136
  • 13
  • 28
  • I don't know if I understood correctly, but if you are trying to get both MySql and MariaDB working against the same DB & table files I think it is not a good idea – nacho Sep 25 '19 at 07:50
  • If you are going to use only one RDMS (or MariaDB or MySQL) and want to access the same table with two different names, you can do it with a VIEW – nacho Sep 25 '19 at 07:53
  • But I don't get the point of using two different names for the same table – nacho Sep 25 '19 at 07:54
  • There are two applications which have different functionality. They operate on the same fields, but have been created to use a different underlying database and different table name. I need to get the two applications to operate on the same data. Changing the internals of the applications to line up the table names is not an option. Why do I need to use the same RDMS in this situation? Is there something specific to VIEWS? MySQL and MariaDB should be pretty compatible. – Tarmo Sep 25 '19 at 08:04
  • I don't get this - you have 2 applications both of which you wish to have an option whereby you can elect to action a table in a mysql or mariadb ? How would your front end select the db to action? AND do you need to keep the tables in the 2 databases in sync? – P.Salmon Sep 25 '19 at 08:15
  • I updated the question, Hopefully it is more clear. I want to connect both applications to the same DB. But the applications are expecting a different table name – Tarmo Sep 25 '19 at 08:52
  • 1
    Basically: views or triggers. See [How do I create a table alias in MySQL](https://stackoverflow.com/q/1890155). But eventually you'll have to test it (and if table a/view b fails, you still have the option view a/table b), some things your application can do will not work 1:1 with a view (e.g. you cannot "lock" a view; retrieving information about the "table" from information schema is different (as a view is, well, not a table, and some orms/db abstraction layers may rely on it); ...). You also need to test if the application actually work together (concurrency/transactions/errors/...). – Solarflare Sep 25 '19 at 09:36
  • If I understood your question correctly: You have 2 (probably closed source) applications which use the same table structure but different table names (which are hardcoded and can't be changed therefore). Q: Do one application needs data from the other application, or do you just want to keep all data in one table for later analysis or further actions, e.g. by using from a 3rd application? – Georg Richter Sep 26 '19 at 06:41
  • One application is writing data into the table. The other application creates a CRUD REST API over the same data and exposes it. – Tarmo Sep 26 '19 at 12:34

0 Answers0