Bug #28168 odbc, non 7-bit password, connection failed
Submitted: 30 Apr 2007 18:25 Modified: 18 Jun 2010 15:32
Reporter: Susanne Ebrecht Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any

[30 Apr 2007 18:25] Susanne Ebrecht
Description:
Hi all,

> select version();
5.1.17-beta

on FreeBSD 6.2 (32 Bit), installed via Ports

> show variables like 'char%';
character_set_client     | latin1
character_set_connection | latin1
character_set_database   | latin1
character_set_filesystem | binary
character_set_results    | latin1
character_set_server     | latin1
character_set_system     | utf8

$ locale
all variables are: de_DE.iso8859-15

I used xterm with encoding de_DE.iso8859-15

$ mysql
> create user foo identified by 'äöü';

I installed unixODBC 2.2.12 (from source) and MySQL-Connector-ODBC 3.51.12
I configured all correctly.

$ isql -v myconnect foo äöü
I get a connect

I add a new user on my system with default settings all are utf8
$ locale
all variables are: de_DE.utf8

I used xterm with encoding de_DE.utf8

$ isql -v myconnect foo äöü
connection failed.

My order for MySQL-Connector-ODBC v5 is, that we should provide, different client encodings to different database encodings. Because, then the user must not be careful with his encoding and it works from every environment.

Of course I also tested the other direction and it was the same.

The other guys from connector team told me, that my problem with the password is definitely a server bug not a connector or unixodbc bug.

Kind Regards,

Susanne

How to repeat:
Try to connect from another enviroment with other encoding settings, than the settings you have used to create the user.
[30 Apr 2007 18:30] Susanne Ebrecht
It is a connector bug
[30 Apr 2007 18:36] Andrey Hristov
The character set of the connection should be set in some way before attempting to call mysql_real_connect() from inside connector/odbc because the character set is sent during the authentication handshake.
[3 May 2007 8:30] Tonci Grgin
Hi Susanne and thanks for your report. Since connector/ODBC v5 is still beta, please consider lowering severity to S4 (feature request).

As Andrey already explained we do need configuration screen in v5 like 3.51 has (Connect Options tab / Initial Statement field).
[22 Oct 2007 15:17] Susanne Ebrecht
I verified this against MyODBC version 5.1.

mysql> grant all on *.* to müller@'localhost';

$ mysql -u müller test

mysql> select user();
müller@localhost

mysql> show grants;
GRANT ALL PRIVILEGES ON *.* TO 'müller'@'localhost'

changing my .odbc.ini:

User           = müller

Try to execute some tests ...
Connection failed.
[18 Jan 2008 21:09] Jess Balint
Connecting with Unicode username and password works fine. It's stored and retrieved correctly by the Windows GUI. This patch fixes the short-period when the character set is utf8 so that we convert the error message correctly.

Index: driver/connect.c
===================================================================
--- driver/connect.c    (revision 1006)
+++ driver/connect.c    (working copy)
@@ -210,6 +210,7 @@
     We always use utf8 for the connection, and change it afterwards if needed.
   */
   mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "utf8");
+  dbc->cxn_charset_info= utf8_charset_info;

   if (!mysql_real_connect(mysql,
                           ds_get_utf8attr(ds->server,   &ds->server8),
[23 Feb 2008 19:42] Jess Balint
fix + test

Attachment: bug28168.diff (application/octet-stream, text), 3.60 KiB.

[25 Feb 2008 22:58] Jim Winstead
don't forget to remove the user in the test.
[16 Nov 2009 18:25] Lawrenty Novitsky
pushed as rev#857(5.1.7)
[18 Jun 2010 15:32] Tony Bedford
Not added to changelog as not a C/ODBC bug.
[2 Dec 2010 9:51] Susanne Ebrecht
All works fine now.