Writing to a MySQL database from SSIS

Source: Internet
Author: User
Tags ssis

Writing to a MySQL database from SSIS
A couple of users reported being unable to use the ADO. NET destination to insert data into their mysql databases. when I originally tried this out, it worked, but it seems like changes made since the early 2008 CTPs have made us incompatible with MySQL. we do have a bug logged to make this more flexible, but the good news is that in the meantime there is a workaround when using the ODBC connector. for the ADO. NET Destination to work properly, the MySQL database needs to have the ANSI_QUOTES SQL _MODEoption enabled. this option can be enabled globally, or for a special session. to enable it for a single session: Create an ADO. NET Connection Manager which uses the ODBC driverSet the connection manager's RetainSameConnection property to TrueAdd 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. setting the RetainSameConnection property to True will ensure that your Execute SQL Task and ADO. NET Destination are in the same session. note, I recommend using the ODBC Driver when writing to the MySQL database, because the MySQL. NET Connector has an additional blocking issue. if you try it out, you'll get an error which looks something like this: Error: 12:03:47. 79 Code: 0xC020844B Source: Data Flow Task 1 Destination-Query [28] Description: An exception has occurred during data insertion, the message returned from the provider is: you have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea r '"name", "date", "type ", "remark") VALUES (p1, p2, p3, p4), (p1, p2, p3, p4), (p1, p2 'at line 1 End Error Note that the "VALUES" portion has parameter names, and not the actual values. this appears to be an issue with the value the MySQL provider returns for its ParameterMarkerFormat. I did find a bug that was opened against them, but it looks like they decided not to fix it. I 've heard that the DevArt dotConnect drivers do not have this problem, but I haven't been able to try them out myself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.