Loading Data into MySQL with SSIS via ODBC (sql_mode = ANSI)
I was performing a test earlier, a proof-of-concept to show that we could use Integration Services to move data from one platform (PostgreSQL) to another (MySQL) without SQL Server itself being involved at all.
Unfortunately I hit a slight snag on the first simple attempt, I could read the data without a hitch but despite multiple attempts at tweaking SSIS settings and reconfiguring connections I could not manage to get data into the MySQL target table. Amongst other messages in the Output window in BIDS I could see the following error…
[MySQL][ODBC 5.1 Driver][mysqld-5.0.45-log]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 ‘”tblDestination” (“col1″, “col2″, “col3″, “col4″, “col5″, “c’ at line 1
After some Googling I determined that the issue was down to an incompatibility between the SQL being generated by SSIS and the default MySQL engine, specifically that MySQL was not setup to accept ANSI compliant SQL. Most of the solutions out there seemed to require that the entire server was configured in the ANSI compliant mode which was a problem for me as it’s a shared server and I can’t go reconfiguring it at will. Thankfully MySQL provides the ability to set the mode on a per connection level with the following command…
SET SESSION sql_mode= 'ansi';
The trick is – how to get SSIS to run this 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…

This is a relatively common feature of ODBC drivers and allows you to setup initial configuration options for this exact reason, now I know that I will not impact any other users of the server and my SSIS package works just fine.
Categories: Microsoft SQL Server, MySQL, Open Source, PostgreSQL, SSIS Tags: .NET, ADO, BIDS, ETL, Integration Services, MySQL, ODBC, Postgres, PostgreSQL, SSIS
SQLBits V: Highlights from Friday Afternoon
Having attended the SQL Bits conference in Newport last month I decided to collate the little tips and tricks I learned at the event, in the challenging post-lunch session on Friday Thomas Kejser gave a talk on Designing I/O Systems for SQL Server – my notes from this talk are either short, sharp facts or references to thing I plan to research further…
The most important metrics are Throughput (measured in MB/sec or IOPS) and Latency (milliseconds).
A 10K RPM disk will give 100-130 IOPS, a 15K RPM disk will give 150-180 IOPS.
Performance can be increased by short-stroking disks, if you build a single partition on a drive using only 10% of it’s capacity this partition will reside physically on the outer edge of the disk. Doing this reduces the amount of head movement required to read the data and improves performance.
Windows Server 2008 handles disk alignment automatically but for earlier versions the offset should be 1024kb.
For testing the effect of configurations on performance use SQLIO.EXE or IOMeter, for stability testing use SQLIOSIM.
Check out the Pre-Deployment Best Practices Whitepaper from Microsoft.
The last talk of the day was by Allan Mitchell and was initially titled Common Integration Services Problems but was changed late-on to a more introductory Solving Problems in ETL using SSIS. The only take-away I got from the talk was to check out a tool called BIDS Helper, I have no criticism of Allan though – he’s a good speaker but in this case I already understood the bulk of the content so it was hard to stay focused.
Categories: Hardware, Microsoft SQL Server, SSIS, Tools & Utilities Tags: Allan Mitchell, BIDS, conference, DTS, IO, IOPS, Microsoft SQL Server, short stroking, SQL Server, SQLBits, SSIS, Thomas Kejser


