Migrate from MySQL (MariaDB) to SQL (Azure) - mysql

I'm having trouble with this process, and would love some pointers!
Current source database is a MariaDB one (similar to MySQL). I have ODBC drivers connecting successfully.
I've installed Microsoft SQL Server Management (SSMS) 17, and connected to my Azure SQL Database.
I've found solutions that its possible to create a Linked Server in SSMS - but for some reason I cant see this in my Object Explorer?
I've tried to use the SQL Server 2017 Import and Export Tool.
Selected the source as .Net Framework Data Provider for ODBC, and entered the name of the DSN.
Select the destination as SQL Server Native Client (also tried Microsoft OLE DB Provider for SQL Server).
First warning thrown up (not sure if this is an issue?)
[Source Information]
Cannot locate the mapping file to map the provider types to SSIS types
And the big error...
TITLE: SQL Server Import and Export Wizard
Could not connect source component.
Error 0xc0047062: Source - tblBookings [1]:
System.Data.Odbc.OdbcException (0x80131937): ERROR [42000]
[ma-3.0.6][5.5.59-MariaDB]You have an error in your SQL syntax; check
the manual that corresponds to your MariaDB server version for the
right syntax to use near '"tblBookings"' at line 1 at
System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle,
RetCode retcode) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavior, String method, Boolean needReader, Object[] methodArguments,
SQL_API odbcApiMethod) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavior, String method, Boolean needReader) at
System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Odbc.OdbcCommand.ExecuteDbDataReader(CommandBehavior
behavior) at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior) at
Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.ReinitializeMetaData()
at
Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostReinitializeMetaData(IDTSManagedComponentWrapper100
wrapper)
ADDITIONAL INFORMATION:
ERROR [42000] [ma-3.0.6][5.5.59-MariaDB]You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server
version for the right syntax to use near '"tblBookings"' at line 1
(maodbc.dll)
BUTTONS:
OK
------------------------------*
Happy to try and do this migration another way too.
Any tips greatly appreciated.

Try executing this as root user:
Set global sql_mode=ansi_quotes

Related

ADO Error: 0x80040e14 exception occurred in microsoft oledb provider for odbc drivers[ODBC 8.0(a)][mysqld-8.0.20] You have an error in your SQL syntax

We have built RFID based system identification application in LabView using MySQL as database.
We have one same software running on two similar computers. Few months before application was running properly on both the computers. Now one is running smoothly but the second one gives following error.
ADO error: 0x80040e14 exception occurred in microsoft ole db provider for odbc drivers [MYSQL] [ODBC 8.0(a)] [mysqld-8.0.20] You have an error in your SQL syntax; check the manual corresponds to your MySQL version for the right syntax yo user near "RFID_tag_number' at line 1 in NI_Database_API.lvlib:Conn Execute.vi...till path of the file.
As you can see there is double inverted comma before RFID_tag_number in the error, but in our code we have only used single inverted comma as it is a string value. We tried to copy complete application from the computer where it is properly running to the second computer but still getting the same error.
The only difference between both computers we found is -
In the computer running properly - In MySQL Workbench >Administrator >Server Status, the Configuration Path is My SQL Server 5.7\my.ini
And in the second computer it is My SQL Server 8.0\my.ini.
We don't know if this is the reason for the error or how the configuration path affects the application. We even tried to remove MySQL server 8.0 completely from computer with the issue and installed MySQL server 5.7 but still the path remained same.
Can anyone help us? We are new to LabView working with MySQL.
What I understand, error will throw for incorrect query,it might be required handling special characters.
Second if same data base access by both system
,system required same version my mysql and odbc driver also.
Third, when you try to remove mysql, delete hidden files in c drive then install new version

'Syntax Error' when using Database Navigator for PyCharm

I have a project with a MySQL database to which I connected using the Database Navigator plugin.
Now when I open the DB Browser window, select the database and click on "Open DB console" and insert the query
SELECT CAST('2017-08-29' AS DATE);
for one, the IDE highlights CAST as an unknown identifier:
and, additionally, when I try to execute the statement, I get the error
Error executing SELECT statement. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 - Connection: test: 112ms
However, to my knowledge, this is valid MySQL, at least this page suggests so.
I am also able to perform MySQL queries with casts from a python script that builds the connection itself.
What am I doing wrong here? Do I have to configure the dialect for Database Navigator?

How can i set MySQL mode to 'ANSI' from an SSIS package

I have an SSIS package that transfers data from MSSQL server 2008 R2 table to MySQL 5.6.
Set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES'
In the package, prior to executing the Data Flow Task that does the transfer, i'm first executing the command above but when the real data transfer step is reached i'm getting error similar to below
An exception has occurred during data insertion, the message returned from the provider is: ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"myColumn1", "myColumn1") VALUES (?, ?)'
As i investigated this, it appeared as though the error can be resolved by setting the MySQL mode to 'ANSI' but since i'm new to MySQL, i was thinking the above command was already setting the Mode to 'ANSI', is this true?
If this isn't true, how can i set the MySQL Mode to 'ANSI' from an SSIS package?
Also what privileges would i need on the MySQL server?
Apparently, the trick is to get SSIS to run this SET SESSION sql_mode= 'ansi'; command before inserting the data without messing with the package itself?
The easiest way is to have the ODBC driver send the command at the point SSIS opens the connection, this can be configured in the settings of the ODBC source
REF: http://www.ash.burton.fm/blogs/2011/03/pgsql_ssis_mysql and indeed this resolved the error i have facing.

Data Transfer from MySql to SQL server using SSMS

I am trying to load data's from MySQL tables to SQL server 2012 tables.
For that i installed "mysql-connector-odbc-5.3.4-win32" driver.
After that importing data using data source " .Net Framework Data Provider For Odbc"
I gave correct connection-string and DSN for Mysql .
At last am getting an error
- Setting Source Connection (Error)
Messages
Error 0xc02020ff: Source - r_cluster [1]: The Source - r_cluster was unable to retrieve column information for the SQL command. The following error occurred: ERROR [42000] [MySQL][ODBC 5.3(a) Driver][mysqld-5.5.25]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"r_cluster"' at line 1
(SQL Server Import and Export Wizard)
Pipeline component has returned HRESULT error code 0xC02020FF from a method call. (Microsoft.SqlServer.DTSPipelineWrap)
Please help me to resolve this issue.
Thanks
I have just looked for the solution to this problem for myself and found the following to work.
In your ODBC Settings (make sure you are using the ANSI driver
Select the details button
In Initial statement at the bottom of the
screen set session sql_mode=ansi_quotes;
MSDN Social - MS server connect to MySQL (ODBC)

Unable to import tables from MySQL

I need to import few tables from MySQL to MSSQL. Below are the steps I followed in SSIS
1). Open the SQL Server Import/Export Wizard.
2). Source connections defined as per the MySQL ODBC Connector.
3). Destination defined as per MSSQL SQL authentication.
now when i try to run the package, i get the following error
"you have an error in your sql syntax; check the manual that corresponds right syntax"
On digging deep into the issue, i found that it is trying to fetch items using a query
Select * from "table"
How do i avoid double quotes? I know it is something to do with ANSI_QUOTES, but how do I set ANSI_QUOTES property
In the file ProgramData\MySQL\MySQL Server 5.6\my.ini edit the "sql-mode" property.
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES"
^