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

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.

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

Error occured while moving data from SQL Server to MySQL using SSIS ODBC Destination Batch method

I am trying to move data from SQL Server to MySQL using SSIS. I have used OLE DB Source for fetching data from SQL Server and ODBC Destination to push data into MySQL tables.
I have kept row by row insert method which is working fine without any error but it is very very slow.
When I tried Batch Insert method, the SSIS Package is failing with following error.
[ODBC Destination[191] Error: Open Database Connectivity (ODBC) error occured. State: 'HYC00' - Native Error Code:0 [MySQL] [ODBC 8.0(w) Driver] [mysqld-5.7.12] Parameter arrays with data at execution are not supported
There are 7 tables having 500 000 records each. It took around 9 hrs to complete using row by row method (no errors but very slow).
But when I choose batch, it is throwing the above error.
How to achieve batch insert for improving the data movement speed? I have installed ODBC 8.0 Driver.
Should I modify the connection string OR should I enable any pre-defined variable in MySQL OR what method can I try to achieve this.

How to fix ODBC Driver 8.0 SQL syntax error in SSIS?

I have a SSIS package which is used to export data from a MySQL database to a SQL database.
For some reason, I can only read data using the ODBC Source item but I cannot preview the table, also, while doing some other tests I found out I can't insert data with the ODBC Destination item either.
Whenever I try I get this error:
ERROR [42000] [MySQL][ODBC 8.0(w) Driver][mysqld-5.7.23]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 "TABLENAME"
at line 1 (myodbc8w.dll).
I'm using MySQL 5.7.23 and MySQL Connector/ODBC 8.0. I have tried switching between ANSI and Unicode connectors; downgrading the connectors version (tried it with 5.3, 5.2 and 5.1); changing database, table and column codification; changing the data access mode in the ODBC Source item (was using "Table Name" by default); remaking the task. Everything results in the same error, even on different computers and databases.
EDIT:
Using #Hadi second workaround lead to some interesting results (the first one didn't work for me).
Using either the ADO.NET or ODBC connector, the provided query resulted in an error.
Error Code: 1231. Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'
After modifying the query to
set sql_mode = 'STRICT_TRANS_TABLES, NO_ENGINE_SUBSTITUTION, ANSI_QUOTES'
the error changed to a warning.
set sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES' 0 row(s) affected, 1 warning(s): 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Still, it worked partially. Any quotations, accents, or any other symbol surrounding any selected table name had to be removed. That made it work fine when inserting data, but when retrieving data it had to be done either from a SQL command or by creating 2 different connections.
While searching for the issue i found some helpful links that mentioned some workaround:
(1) Connecting to MySQL issue
Connecting to MySQL from SSIS
In this link the author mentioned 2 methods to connect to MySQL (using ODBC and ADO.net). He mentioned that while trying to retrieve tables using ODBC he received the same error that you have listed in the question, and he mentioned the solution as below:
Switching to use a SQL query instead, and that worked just fine. I was able to pull back both the correct metadata, with one small problem - the varchar(50) columns came back with a length of 51. This resulted in some warnings, but the package ran correctly.
(2) Writing to MySQL issue
Writing to a MySQL database from SSIS
In this article the author mentioned how to write to a MySQL destination using ADO.Net destination, he mentioned the solution below:
For the ADO.NET Destination to work properly, the MySQL database needs to have the ANSI_QUOTES SQL_MODE option enabled. This option can be enabled globally, or for a particular session. To enable it for a single session:
Create an ADO.NET Connection Manager which uses the ODBC driver
Set the connection manager’s RetainSameConnection property to True
Add an Execute SQL Task before your data flow to set the SQL_MODE – Ex. set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES'
Make sure that your Execute SQL Task and your ADO.NET Destination are using the same connection manager.
Other similar links
SSIS problems with MySQL Connector/ODBC 5.3.8
SSIS and MySQL - Table Name Delimiter Issue

SQL Server 32-bit easysoft IB6 odbc SSIS package failing with validation error: codes 0x80004005 and 0xC0014009 when run by a sql server agent job

I have a SSIS package on sql server 2012.
It utilizes an easysoft odbc connection to access and optima attendance controller. In my project, I have
Run64BitRuntime is false. My SQL Agent Job is also set for 32 bit run time.
I use and SSIS proxy account and it is an admin account.
I have another package running on the same server using a different odbc provider, timebersoft, but it runs without issue.
If you need more details please let me know what you need to know.
The following errors only occur when the package is exacuted by a sql server agent job.
Data Flow TAsk: Error: ODBC source failed validation and returned error code 0x80004005
attnd: Error: There was an error trying to establish and Open Database Connectivity (ODBC) connection with the database server.
Data Flow Task: Error: The AquireConnection method call to the connection manager Attnd failed with error code 0xC0014009.
I have attempted to create a hello world version and every time the only thing to cause it to crash is when i try to connect to the easysoft odbc. the driver is installed (Name{Easysoft IB6 ODBC}; Version{1.00.01.70}; Company{Easysoft Limited}; File{IB6ODBC.DLL}; Date{6/5/2002}) the user is the same administrator for the successful and unsuccessful attempts
Update: July 21:
1. Tried the installation that wasn't it.
2. Tried Operation system(cmdline) for using 32 bit detexec.exe failed again. (double checked and the command I used did work in the cmdline)
Here are a couple of things you must check (going from front end to back end). See what you are missing.
Run64BitRuntime is set to false in the project setting.
The same configuration setting (having Run64BitRuntime set to false) should be used for deployment.
If you are using an external configuration file, and that has this property, see that it is set to false.
SQL Server > Database Engine > SQL Server Agent > Jobs > Your job's properties > Select the step where you run the SSIS and click Edit> In the 'Execution Options' tab check 'Use 32 bit runtime'
Hope this helps!
"You can use our Interbase ODBC driver from SQL Server Agent or any ODBC enabled application. You will however need to install a 64-bit Interbase client that is compatable with your Interbase server before you install the Easysoft ODBC driver. This can be obtained from Embarcadero"
the issue appears to be with the software. In order to use easysoft on a 64 bit system i need the 64 bit driver properly installed.
Thank you #billinkc for pointing out the installation issue.

Trying to migrate SQL Server to MySQL using MySQL Workbench. Error: "[Microsoft][ODBC Driver Manager] Invalid argument value" when migrating data

Long time lurker, first time poster; hoping anyone can help me out.
Im using MySQL Workbench 5.2.41 to migrate a database from SQL Server to MySQL 5.0.8
The entire process goes smoothly: both SQL and MySQL connection Tests are good, the skemea and table create as expected, everything checks out until the 'Bulk Data Transfer' step. At that point I receive this error:
...
Migrating data...
wbcopytables.exe --odbc-source=DSN=SQL Server 11;DATABASE=;UID=sa --target=root#127.0.0.1:3306 --progress --passwords-from-stdin --thread-count=1 --table [GSAClosers_v2] [dbo].[AccountBase] `dbo` `AccountBase`
`dbo`.`AccountBase`:Copying 84 columns of 169530 rows from table [GSAClosers_v2].[dbo].[AccountBase]
ERROR: `dbo`.`AccountBase`:SQLGetData: HY009:10:[Microsoft][ODBC Driver Manager] Invalid argument value `dbo`.`AccountBase`:
Finished copying 0 rows in 0m00s
Copy helper has finished
...
For connectors I'm using Microsoft SQL Server / ODBC Data Source / DSN: SQL Server and for MySQL the IP and port(3306).
SQL Server 2012 Management Studio connects and all operations work as expected.
O, side not: both are on the same localhost machine.
If anyone can shed some light on this I would be forever indebted. Thanks in advance
From here:
[Microsoft][ODBC Driver Manager] Invalid argument value.
Regarding to the error message and code you provided, which seems is
database is invalid or cannot be accessed. That means either the
database does not exist or the user does not have permission to access
the database.
It turns out you need specify the instance after the server name, so
in the server name in the dialog box for creating the ODBC Data
Source, you must enter it as either: MyServer\SQLEXPRESS or
.\SQLEXPRESS
I think you may have a problem connecting to your database from wbcopytables.exe. Keep in mind that this is a separate tool so the fact that you can connect from the rest of the Migration Wizard doesn't imply that you will connect in wbcopytables.exe.
The thing that worries me the most is that your DSN has whitespace characters. This might be interpreted by the Windows terminal as independent command line parameters. One thing you can do is to edit your DSN name removing the whitespaces and try again.
You may also want to connect without a DSN by putting all your connection parameters explicitely as explained in my blog post: How-To: Guide to Database Migration from Microsoft SQL Server using MySQL Workbench.
And, by the way, since MySQL Workbench 5.2.42 is out you should go and get it. The Migration Wizard is pretty new so important bug fixes are likely launched in each recent Workbench release.
In either case I think you should file a bug with your issues with a detailed explanation about how to reproduce it, possible solutions, etc.
Hope this helps.
Ok, got it figured out: un-install java. install java 1.6, use MySQL Migration Tool. change all data types to varchar, ints and bits. run migrations....eat data.