Bug #84071 Cant migrate from SQL Server to mysql
Submitted: 6 Dec 2016 7:55 Modified: 13 Nov 2017 0:03
Reporter: toby tt Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S2 (Serious)
Version:6.3.8 OS:Windows (win7)
Assigned to: CPU Architecture:Any
Tags: illegal UTF-16 surrogate

[6 Dec 2016 7:55] toby tt
Description:
Starting...
Connect to source DBMS...
- Connecting...
Connecting to Mssql@xxx.xxx.xxx.xxx...
Opening ODBC connection to DSN=
;DATABASE=database;UID=t;PWD=XXXX...
Connected to Mssql@xxx.xxx.xxx.xxx, 12.0.4100.1
Connect to source DBMS done
Reverse engineer selected schemas....
Reverse engineering dbo from database
- Reverse engineering catalog information
- Reverse engineering User Data Types...
- Preparing...
- Gathered stats for dbo
Reverse engineering 76 tables from dbo
Traceback (most recent call last):
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\db_mssql_grt.py", line 391, in reverseEngineer
    reverseEngineerTables(connection, schema)
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\db_mssql_grt.py", line 552, in reverseEngineerTables
    table_names = [(row[0], row[1]) for row in execute_query(connection, query % schema.name) ]
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\db_mssql_grt.py", line 131, in <lambda>
    con.add_output_converter(-150, lambda value: value if value is None else value.decode('utf-16'))
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\Python\Lib\encodings\utf_16.py", line 16, in decode
    return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode bytes in position 6-7: illegal UTF-16 surrogate

Traceback (most recent call last):
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\workbench\wizard_progress_page_widget.py", line 192, in thread_work
    self.func()
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\migration_schema_selection.py", line 175, in task_reveng
    self.main.plan.migrationSource.reverseEngineer()
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\migration.py", line 369, in reverseEngineer
    self.state.sourceCatalog = self._rev_eng_module.reverseEngineer(self.connection, self.selectedCatalogName, self.selectedSchemataNames, self.state.applicationData)
SystemError: UnicodeDecodeError("'utf16' codec can't decode bytes in position 6-7: illegal UTF-16 surrogate"): error calling Python module function DbMssqlRE.reverseEngineer
ERROR: Reverse engineer selected schemas: UnicodeDecodeError("'utf16' codec can't decode bytes in position 6-7: illegal UTF-16 surrogate"): error calling Python module function DbMssqlRE.reverseEngineer
Failed

How to repeat:
Starting...
Connect to source DBMS...
- Connecting...
Connecting to Mssql@xxx.xxx.xxx.xxx...
Opening ODBC connection to DSN=
;DATABASE=database;UID=t;PWD=XXXX...
Connected to Mssql@xxx.xxx.xxx.xxx, 12.0.4100.1
Connect to source DBMS done
Reverse engineer selected schemas....
Reverse engineering dbo from database
- Reverse engineering catalog information
- Reverse engineering User Data Types...
- Preparing...
- Gathered stats for dbo
Reverse engineering 76 tables from dbo
Traceback (most recent call last):
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\db_mssql_grt.py", line 391, in reverseEngineer
    reverseEngineerTables(connection, schema)
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\db_mssql_grt.py", line 552, in reverseEngineerTables
    table_names = [(row[0], row[1]) for row in execute_query(connection, query % schema.name) ]
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\db_mssql_grt.py", line 131, in <lambda>
    con.add_output_converter(-150, lambda value: value if value is None else value.decode('utf-16'))
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\Python\Lib\encodings\utf_16.py", line 16, in decode
    return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode bytes in position 6-7: illegal UTF-16 surrogate

Traceback (most recent call last):
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\workbench\wizard_progress_page_widget.py", line 192, in thread_work
    self.func()
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\migration_schema_selection.py", line 175, in task_reveng
    self.main.plan.migrationSource.reverseEngineer()
  File "E:\app\dev\MySQL Workbench 6.3.8 CE (winx64)\modules\migration.py", line 369, in reverseEngineer
    self.state.sourceCatalog = self._rev_eng_module.reverseEngineer(self.connection, self.selectedCatalogName, self.selectedSchemataNames, self.state.applicationData)
SystemError: UnicodeDecodeError("'utf16' codec can't decode bytes in position 6-7: illegal UTF-16 surrogate"): error calling Python module function DbMssqlRE.reverseEngineer
ERROR: Reverse engineer selected schemas: UnicodeDecodeError("'utf16' codec can't decode bytes in position 6-7: illegal UTF-16 surrogate"): error calling Python module function DbMssqlRE.reverseEngineer
Failed
[6 Dec 2016 11:34] Milosz Bodzek
Hi Toby,
Thank you for the bug report. Can you provide description step by step what you done, which driver you use, which options you select etc. Also would be good if you can attach test db, that we can reproduce and fix issue.
[6 Dec 2016 15:29] MySQL Verification Team
Please take a look in this article: http://dba.stackexchange.com/questions/37343/sql-server-to-mysql-migration-how-can-i-remov...
Thanks.
[7 Dec 2016 2:01] toby tt
Consider security policy,can not attach test db.
Here are some additional information,we have several DB in MSSQL,only one DB can migrate successfully.
if the have some strange characters in MSSQL,Could Workbench Migration tool process automatically? since we have so many tables. thanks a lot!

1.Tool version
a. Workbench 6.3.8 Community
b. Microsoft SQL Server 2014 - 12.0.4100.1 (X64) 
c. MySQL Community Server5.7.16 
d. Operation system: Win7
e. Microsoft SQL Server ODBC driver version 06.01.7601

2.Steps
a.follow migration task list step
b.get error message when arrive reverse engineer source phase
[7 Dec 2016 4:02] toby tt
one more information:
this issue disappear on linux【redhat 7.2】.
[8 Dec 2016 15:31] MySQL Verification Team
Without a test case we can't reproduce the issue reported, what you meant with: this issue disappear on linux【redhat 7.2】.. Thanks.
[9 Dec 2016 1:53] toby tt
@Miguel Solorzano
Firstly i installed workbench on WIN7,then execute migration steps,get the error message.
Then do the same migration action on my colleague's WIN7, get the same error message.

In the end,we try to install workbench  on REDHAT【version 7.2】.execute migration steps, data in MSSQL was migrated successfully.
[13 Oct 2017 0:03] MySQL Verification Team
Please try version 6.3.9. Thanks.
[13 Nov 2017 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".