Bug #3727 Connection string not working with MySQL 4.1 and ODBC 3.57.06
Submitted: 12 May 2004 15:30 Modified: 28 Jul 2004 22:31
Reporter: Sinisa Milivojevic Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Any (any)
Assigned to: Timothy Smith CPU Architecture:Any

[12 May 2004 15:30] Sinisa Milivojevic
Description:

I have a problem when using MyODBC (both 2.50.39 and 3.51) with a connection string and MySQL 4.1 (running on a Win2k).

The database is created with the cp1256 character set, system is running latin1.

case 1) use DSN-less connection string

conn.open("Driver={MySQL};Server=10.0.0.111;DATABASE=ar;UID=user;PWD=123;STMT=set names cp1256")

Connection opens fine but it seems like the "set names cp1256" statement hasn't been done. Because when I run a "show variables like

'char%'" it says latin1 the places where it should say cp1256... Also when I perform a select query with a where clause I receive the

following error message:

[mysqld-4.1.1a-alpha-nt-log]Illegal mix of collations (cp1256_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation

'='

If I execute the "set names cp1256" on the connection after opening it, the program works fine... But I need this to be embedded in

the connection string.

case 2) use a DSN connection

conn.open "DSN=ar;UID=user;PWD=123" ' DNS contains sql command on connect = set names cp1256;

This works perfectly. But I need it to work with a DSN-less connection (case 1).

Is there anything I'm doing wrong?

How to repeat:
"set names cp1256" on the connection after opening it, the program works fine... But I need this to be embedded in

the connection string.

case 2) use a DSN connection

conn.open "DSN=ar;UID=user;PWD=123" ' DNS contains sql command on connect = set names cp1256;
[23 Jul 2004 22:15] Peter Harvey
Fix applied and in bk ready for next build (next week). See attached file for test case.
[23 Jul 2004 22:16] Peter Harvey
C test program

Attachment: test.c (application/octet-stream, text), 5.44 KiB.