最近几天用SSIS 向MYSQL数据库中导入数据,出现各种意想不到的问题.现总结如下:
driver: 使用5.1.11的mysql connector. SQL server 2008R2
解决办法:
- 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.
完整版本参考http://blogs.msdn.com/b/mattm/archive/2009/01/07/writing-to-a-mysql-database-from-ssis.aspx
但是还是会出现随即几条数据插入时出现错误.ERROR CODE -1071610801
参考其他文章,换了个driver,不再出现.
另外发现一个问题,就是如果再一个data flow 里,如果出现两个ado.net destination时,数据会随即的出现插入错误,并行越多,错误出现的越多,大概90%的行没有被插入.
所以解决办法就是,让每个data flow里面只出现一个destination,并且不使用并发执行. 顺序执行每个data flow. problem solved.