fredag den 27. april 2012

Migrate from SQL Server to MySQL

On 64-bit windows
Download MySQL GUI tools
Make sure to have a 32-bit java
Run tool from CMD line
MySQLMigrationTool.exe -verbose -debug
-jvm "C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll"
Alert box may appear with problem finding msvcr100.dll
In that case, rename msvcr100_clr0400.dll to msvcr100.dll in C:\Windows\SysWOW64
When tool is up and running, choose MS SQL server as source and MySQL as dest
If you are using UTF8, choose multilingualism and shit
Export inserts to a file
Check that encoding is correct with a tool, maybe Notepad++
If not correctly encoded, run tool again till an advanced tab shows you the JDBC connection string
find the string for MS SQL and copy it (UPDATE: its 'characterEncoding=UTF-8')
Go back to 'source selection', click 'advanced', input JDCB string, remove any encoding options
This way, the output is not encoded before being written to output
If encoding still fails, try setting environment option JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8, before running tool again