Update MySQL Database from values in MS SQL - mysql

Basically I have an MS SQL database in one location (location A) and I need to update the results of a specific SQL query in to a MySQL server in another location (location B) which is behind a VPN. The MySql server can only be accessed when connected to the VPN.
I've tried to connect to the VPN on the machine which has the MS SQL database on it (in location A), downloaded the MySql connection software to enable it to connect to a MySql database in an attempt to create a linked server, but alas, that machine when connected to the VPN cannot see the MySql database or at least fails to connect. (I know I'm using the correct security credentials).
I should probably mention that this MS SQL machine is a file server with a fixed IP address and hence fixed DNS etc. I think this may have something to do with why it's failing.
I've tried adding the DNS server IP addresses (that get given out when it connects to the VPN) to it's list of available DNS servers through tcp/IP config, but still no luck.
The annoying this is that if I connect to the VPN on another computer - say my desktop machine, I can connect to both the SQL server (through SSMS) and the MySql server (through Toad for MySQL).
So I guess the question is, without writing a console app to query the SQL database and then add the results of that query in to the MySql databse, or get SQL to spit out the insert query (in text form) to then run in to the MySql database (there's 350000 rows), is there another, more tidy and clean way to achieve this? This is really a one-off exercise.
Thanks for your help in advance.

Export the data from the MS SQL server in CSV file (or SQL script) and import it into the MySQL server.
If it is only specific columns that you want to update then export oly them plus the primary key (if you have one) to a CSV file and then do some text replacement in order to build a update queries out of the data.

Related

I need connection to an Access Database from a mysql stored procedure to update tables i already create in mysql db

The access database is on server in folder. I need to create a stored procedure to connect to the access database and update the table data. It can be truncate then an insert. It is connecting via stored procedure to the access database i cannot figure out. It has to be done via a job on a schedule.
MySQL (the Sun- then Oracle- owned product) lacks the plumbing to connect to external tables unless they're on other MySQL servers. That is, it only has a FEDERATED storage engine. So, with MySQL you'll have to find some other way to handle your requirement; a MySQL event or other stored code cannot hit your Access tables.
MariaDB, the MySQL fork, has a CONNECT storage engine. It allows the server to hit external tables via ODBC, so you can hit Access with it. MariaDB is almost entirely compatible with MySQL, so maybe you can replace your MySQL server with it. The CONNECT documentation says this, however.
...these table types cannot be ranked as stable. Use them with care in production applications.
To me, that warning means don't do it!. Especially with a busy business-critical application (like a credit department might use) you don't want even a little bit of instability. If you truncate a table and then the reload fails, you'll be able to hear users yelling from the next county.
Your requirement is, I believe, to extract the contents of one (or more) Access tables and import them into a MySQL table. That kind of operation is called extract-transform-load etl. It seems you use SSIS for the purpose. That should work, because SSIS can connect to Access (of course) and to MySQL via the Connector/net or Connector/ODBC drivers.
But, scheduled SSIS packages get run from SQL Server database servers. You didn't say you have one of those at your disposal. If your org does have a production SQL Server instance, you can put your Access - to - MySQL package into it.
Otherwise you will have to figure out a way to run your scheduled etl job without relying on a database job (or event, as they're called in the MySQL world). For that you'll use the Task Scheduler on Windows, or a cronjob on a UNIX-derived OS like Linux or FreeBSD.
I bet you can do this work reliably from a Windows PowerShell script or a Linux shell script.

How to connect to a remote MySQL from an Azure SQL server/database

sorry if title is not so clear, probably I am not finding what I need due I do not know how to search
I have few MySQL servers is separated online servers (from different wordpress) and I want to load some of the data on those databases/tablets into a SQL database located on Azure.
inside Azure portal itself I do not see where to establish external connections, neither at server level, neither at database level
I download and install Microsoft SQL Server Management Studio, connect to the server, I can see my databse and the master one, Security with logins, and Integration Service Catalog, nothing else.
I was looking for something like:
https://www.jetbrains.com/help/go/db-tutorial-connecting-to-ms-sql-server.html#step-3-connect-to-microsoft-sql-server-with-datagrip
but nowhere ...
maybe something like this:
https://www.devart.com/odbc/mysql/docs/microsoft_sql_server_manager_s.htm
but no Servers objects option available on my SSMS
Can be this done?
Note: Azure database is a basic wfor now, if that is a limitation
Some choices.
In your SQL Server Management Studio create a linked server pointing to each MySQL instance. You found the instructions for that. https://www.devart.com/odbc/mysql/docs/microsoft_sql_server_manager_s.htm But it probably will not work in Azure SQL Server; you don't have access to the underlying Windows OS to install stuff like MySQL ODBC drivers, which you need. (You could ask Azure techsupport if they can help.)
In each MySQL instance, try creating a federated table connection to appropriate table in SQL Server. That cross-vendor federation stuff only works in MariaDB, however; MySQL's federation only goes MySQL <--> MySQL.
Write yourself a purpose-built extract / transform / load (ETL) program, and arrange to run it every so often. Program it to connect to all the servers involved, retrieve the data needing to be transferred from your MySQL servers, and update / insert that data on the SQL server.
(edit) You may be able to use command-line SQL client programs. mysqldump, with its --compatible option, may generate usable INSERT statements in a file. You then may be able to use sqlcmd to run those INSERTs on your Azure server. It's going to take some hacking, and may take using sed(1) or awk(1) to make the MySQL output compatible with SQL Server.
I believe the third option is the most robust one for production use.

How do I connect the RIGHT way from One Server SQL to another and make updates?

I have two servers that I want to integrate between, Both are using MySQL server.
I would like to be able to run a Query from one Server to the other server and search the DB using a filter that I have and apply the changes while checking the DB on the other server.
The scenario is like this:
Server One: MySQL server with Database of Clients with a Status field that is member and I want to update the customer details in the CRM server by the FILTER BY STATUS=MEMBER. Select * From Customers where status=Member (or somthing like that). the Idea is that I would be able to CONNECT the CRM Server and run the task on it's Database. can that be doen? and How can I do that?
AND
Server Two (CRM): has its MySQL server as well and a database of Members with all connections. I would be happy to be able to connect the CRM server with all the info I got from the other server using the Filter that I mention above and update the members database accordingly.
How can I do that? I need to connect the Server using the root#hostname user with all privileges that I will be able to manipulate any Database that I will chose to work on. And update it on will.
Please assist me with the above integration and how do I do that? What is the RIGHT way to connect from one server MySQL server using a query with Filtering to another Server's SQL database and update it?
Please assist.
Thanks
Arye

How can I migrate my MsSQL database on a hosted website to a MySQL database on a different hosted website?

I have a MsSQL 2008 database hosted on somee.com . I have purchased another hosting under net4.in which is providing me MySQL database. So now, how can I migrate/synchronise my MsSQL database to the MySQL database ?
I have tried below things but in vain :
There is an inbuilt facility provided in the MySQL in net4.in to synchronise two databases on remote servers,where I have tried selecting the target server as "Current Server" and in Source Server, I have selected "Remote Server" and provided connection details which were available to me from somee.com . Unfortunately, the Socket and Port details are not provided on somee.com, I have tried giving various values like "TCP/IP" and "1433"(the default value) but in vain.
There is an import facility in MySQL in net4.in , in which I have given the format of imported file as "SQL" and SQL compatibility mode as "MSSQL" , but it is giving an error showing some encrypted text from my MSSQL database saying that its not able to understand it.
The easiest way is to export a csv or .sql file of your existing database then import it using our web-based DB management tools at http://db.infuseweb.com.
However, this may not always be effective especially if you have very large database files. In which case you will need to submit a support ticket and provide us with a MSSQL .bak file or all the MySQL database files from your old host. You will also need to create an empty database in Helm with the exact same database name and users/passwords that you have with your old host. We will then move the database under your account.

TeamCity won't create its schema in SQL Server

I've installed a new TeamCity instance and just moved from internal storage to database (SQL Server). Followed the instructions at http://confluence.jetbrains.com/display/TCD7/Setting+up+an+External+Database and I know I've done the database part correctly as it wouldn't initially connect and I had to go back and turn on TCP/IP connections for SQL Server.
From the documentation I assumed that team city would create and maintain it's own database schema, but even though it's user is dbo the database remains blank - no tables, views or any other objects have been created.
When I try to connect to it in a browser I get "Database is empty or doesn't exist", and viewing the logs shows me "Schema contains no tables". I've obviously restarted the service and connected again each time.
Is there an install script I am missing? How do I get TeamCity to install it's schema?
When you are doing it like this, you will need to migrate the initial structure over to sql server. See here