Bug #62365 Insert Into MySQL over linked server when a medium text is the last column break
Submitted: 6 Sep 2011 14:47 Modified: 11 Oct 2011 9:27
Reporter: Andy Dillbeck Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.1.9 OS:Windows
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[6 Sep 2011 14:47] Andy Dillbeck
Description:
When an insert is made over MySQL Connecter/ODBC to a table with a TEXT (MEDIUMTEXT, LARGETEXT, etc) field in the last column, the first int field gets set to 0 instead of the number it should be.

If a non TEXT field is in the last column, then the first int performs as expected.

How to repeat:
From phpmyadmin:

CREATE TABLE `tblState` (
  `StateID` int(11) NOT NULL,
  `State` varchar(50) NOT NULL,
  `Details` mediumtext NOT NULL,
  PRIMARY KEY (`StateID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `tblState2` (
  `StateID` int(11) NOT NULL,
  `Details` mediumtext NOT NULL,
  `State` varchar(50) NOT NULL,
  PRIMARY KEY (`StateID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

From SQL Server over linked server: 

insert into mysql...tblState(StateID,State,Details) values (1,'alabama','test1')

(1 row(s) affected)

select * from mysql...tblState

StateID     State                Details
----------- -------------------- -------------------- 
0           alabama              test1

(1 row(s) affected)

select * from mysql...tblState2

(1 row(s) affected)

insert into mysql...tblState2(StateID,Details,State) values (1,'test2','alabama' )

StateID     Details              State                                              
----------- -------------------- -------------------- 
1           test2                alabama

(1 row(s) affected)

Suggested fix:
Don't know enough of the inner workings of ODBC
[7 Sep 2011 13:36] Andy Dillbeck
Also, MySQL Connector/ODBC has all the default options (no boxes checked) in ODBC Data Source Administrator, System DSN.
[9 Sep 2011 14:54] Andy Dillbeck
So here is a really dumb work around, until a real fix can be found.
I added an empty bit(1) column to the end of all the tables with Text fields at the end. Now all my inserts work correctly, with the disadvantage of extra table overhead, even if it's only one byte. Thankfully it doesn't mess up the DTS job.

Hopefully a real fix can be found.
[10 Oct 2011 3:29] Bogdan Degtyariov
This query crashes the driver version 5.1.9 and MS SQL process too.
Must be addressed ASAP.
Setting the bug status "Verified".
[11 Oct 2011 5:08] Bogdan Degtyariov
Installing MSSQL Express SP4 helped to fix the crashes. 
So, apparently it was not in the driver.
However, the problem with the column still persists.
[11 Oct 2011 9:27] Bogdan Degtyariov
This is a duplicate of bug #56253