from sql server to mysql with php

4

I have a SqlServer database and need, via php script, to send the data from a table to a MySql database.

Will OPENQUERY result within the condition I have (php script)?

How best to do this?

The code I use to connect banks:

SqlServer:

$conMsSql = odbc_connect('Banco_MsSql','User_MsSql','Pw_MsSql');

MySql:

$hostname_mysql = "localhost";
$database_mysql = "banco_mysql";
$username_mysql = "user_mysql";
$password_mysql = "pw_mysql";
$Conn = mysql_pconnect($hostname_mysql, $username_mysql, $password_mysql) or trigger_error(mysql_error(),E_USER_ERROR);
$DBase = mysql_select_db($database_mysql,$Conn) or die(mysql_error());

And it would look something like this:

$query = mysql_query('insert into tabela1 ( col1, col2, col3 )
 select sqlserver.tab1.col1, sqlserver.tab1.col2, sqlserver.tab1.col3 from sqlserver.tab1')
    
asked by anonymous 20.08.2015 / 14:09

1 answer

1

If your database is very large, it is advisable that your routine use script co_de backup , write this mysqldump file to a folder and finally read this file in SQL through Sql Server .

Because the database size is possibly large, it would be ideal to use a language such as procedure and keep that Java / applet on your server with script , so thread it would treat this migration without major problems, such as Java or other controls / limits that timeout     

24.08.2015 / 14:27