I've created a website with CMS magento2 and I'm working with a MySQL database. now I need to connect it with SAP database which is a SQL Server DB. my question is how to insert data from a table in SQL server into another table in MySQL DB?
-
1Do you want to do this by code or by data migration? Do you know how to retrieve data from SQL server by code? and how to insert data to MySql by code?Chetan– Chetan2017-05-27 16:50:56 +00:00Commented May 27, 2017 at 16:50
-
@ChetanRanpariya I want to do this by code but still do not know howSouhail Chougrani– Souhail Chougrani2017-05-27 16:56:32 +00:00Commented May 27, 2017 at 16:56
-
Have you written any code for this till now? How are you retrieving data from SQL server at first place? And let say if you have data in hand do you know how to insert it to MySQL? Both the servers have same structure of database? Do you know about ado.net?Chetan– Chetan2017-05-27 17:01:33 +00:00Commented May 27, 2017 at 17:01
-
indeed I didn't write any code...Thanks sir i'll search for all this questionsSouhail Chougrani– Souhail Chougrani2017-05-27 17:12:35 +00:00Commented May 27, 2017 at 17:12
2 Answers
You need to use a linked server.
This question was already answered here: Inserting from MS SQL Server to MySQL database
1 Comment
You have two options:
You can create a restful API that receives the serialized data from one db and formats the data before pushing the data down to the db you want to use. The good thing about it is you can easily share data between the 2 DBs without having to worry. Quite flexible because the tables can be identical or not depending on what you need.
You can use the SIS ( Server Integration Services) tool present in the SQL Server that allows integrations into other database systems. It is a bit technical but here are a few steps you can follow on link to explain the integration of SIS packages with MySQL.