Writing to a MySQL database from SSIS_MySQL

PHP中文网
发布: 2016-05-27 13:46:34
原创
1758人浏览过

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.

 

Hot Tattoo AI
Hot Tattoo AI

人工智能纹身生成器,提供独特的纹身创意

Hot Tattoo AI 52
查看详情 Hot Tattoo AI

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 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.

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: 2009-01-05 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.

以上就是Writing to a MySQL database from SSIS_MySQL的内容,更多相关内容请关注PHP中文网(www.php.cn)!

相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号