Bug #49948 Field not returned via ODBC connection
Submitted: 27 Dec 2009 23:14 Modified: 1 Feb 2010 9:08
Reporter: Zoltan Kiss Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:mysql connector odbc 5.1.6 win32 OS:Windows (XP32 SP3 Hungarian)
Assigned to: CPU Architecture:Any
Tags: ODBC driver 5.1.6 problem

[27 Dec 2009 23:14] Zoltan Kiss
Description:
Some day ago I upgrade my ODBC driver on my WinXP from 3.51 to 5.1.6.
The MySQL server was earlier upgraded to 5.1.41.

When I try to select the field "NEV" from my table, the ODBC driver was cut out this field from the field list.

The select working correct via the 'MySQL Query browser', which is not use the ODBC driver.

When I downgrade back to version 3.51 the select working good again!

When I inspect the table structure I found the problem.

The "NEV" field was created with the following option:
CHARACTER SET utf8 COLLATE utf8_hungarian_ci

When I remove the CHARSET and COLLATE from the filed decelartion, the SELECT send the correct field list to me.

How to repeat:
CREATE TABLE `test`.`users` (
  `AZONOSITO` int(11) NOT NULL DEFAULT '0',
  `SZINT` int(11) DEFAULT NULL,
  `NEV` varchar(32) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL,
  PRIMARY KEY (`AZONOSITO`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=latin1

Try the query via any program which is use the ODBC connector:
SELECT * from `users`;
and you will get the following filed list:
"AZONOSITO", "SZINT"

Remove the "CHARSET" and "COLLATION" with
ALTER TABLE `test`.`users` MODIFY COLUMN `NEV` VARCHAR(32);
and the select will send the expected result, which is the same via ODBC 3.51
"AZONOSITO", "SZINT", "NEV"
[28 Dec 2009 15:26] MySQL Verification Team
I couldn't repeat on Windows Vista X64 and linking the table with MS Access 2003.
[1 Feb 2010 9:08] Tonci Grgin
Zoltan, I can not repeat this too using ODBCte32w generic Microsoft ODBC client... All went just fine:

	Full Connect(Default)

	Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

	Successfully connected to DSN '5-1-6-on-opensol'.
SQLExecDirect (create table):
	In:	hstmt = 0x008F5BA8, szSqlStr = "", cbSqlStr = -3
	Return:	SQL_SUCCESS=0
SQLExecDirect (select *):
	In:	hstmt = 0x008F5BA8, szSqlStr = "", cbSqlStr = -3
	Return:	SQL_SUCCESS=0

Get Data All:
"AZONOSITO", "SZINT", "NEV"
0 rows fetched from 3 columns.

I suggest you take a look at your MySQL server error log and general query log and see if you can find anything there. If not, start ODBC trace and check.