http://dev.mysql.com/doc/refman/5.0/en/myodbc-windows-binary-installation.html

I don't know how to use Delphi. But I think Delphi is easy to use ODBC just 
like VB or PB.

Run "set names utf8" just like a normal SQL statement after connect.

If you don't understand let me know.

regards,

gu lei

----- Original Message ----- 
From: "Daniel Levy" <[EMAIL PROTECTED]>
To: "古雷" <[EMAIL PROTECTED]>
Sent: Thursday, March 23, 2006 3:26 PM
Subject: Re: Unicode (UTF-8) question


> Dear Gu Lei,
> 
> Again, thank you very much for your reply and your help.
> 
> I'm working with MySQL 5.0.18-nt via TCP/IP, MyODBC 3.51.12.00, and Delphi 5 
> on Windows XP Pro. The database in installed locally on the computer.
> 
> From what you say, I understand that you need to set "set names utf8" before 
> every attempt to connect to the db and retrieve data. Is this correct?
> 
> Also, in the sample code you sent me, you call routines defined in 
> odbc32.dll, such as SQLAllocHandle and SQLExecDirect. Is there a file on the 
> internet with the definitions (interface) of the routines defined in this 
> dll, so that I can call them from Delphi?
> 
> Thanks again. Best regards,
> Daniel
> 
> 
> 
> ----- Original Message ----- 
> From: "古雷" <[EMAIL PROTECTED]>
> To: "Daniel Levy" <[EMAIL PROTECTED]>
> Sent: Thursday, March 23, 2006 3:41 AM
> Subject: Re: Unicode (UTF-8) question
> 
> 
>> Daniel Levy,
>>
>> My pleasure.
>>
>> We have serveral communication servers such as mail server, SIP server and 
>> conference server. All of them connect to and get data from a server 
>> called PS server. And PS server read and write data from and to MySQL5.0 
>> through MyODBC. Some of the data include Chinese. We use utf8 to store 
>> Chinese in MySQL. All of those servers are on Linux.
>>
>> We use mysql-connector-odbc 3.51.12.
>> Before this version mysql-connector-odbc reconnected to MySQL 
>> automatically after connection lost. After reconnection ,variables' value 
>> set by "set unames utf8" were restored to default "latin1". At that time 
>> PS server can not read and write correct Chinese from and to MySQL.
>>
>> I don't know if what I said is enough.
>>
>> Regards,
>>
>> gu lei
>>
>> ----- Original Message ----- 
>> From: "Daniel Levy" <[EMAIL PROTECTED]>
>> To: "古雷" <[EMAIL PROTECTED]>
>> Sent: Wednesday, March 22, 2006 6:57 PM
>> Subject: Re: Unicode (UTF-8) question
>>
>>
>>> Dear Gu Lei,
>>>
>>> I have been reviewing your reply to the question I posted on the mysql 
>>> list.
>>>
>>> Due to the problems I was having trying to retrieve Unicode data using
>>> MyODBC, I decided to try other third-party data access components. When I
>>> thought that I finally found a solution, I started getting some strange
>>> internal errors in the IDE. I'm using Delphi 5.
>>>
>>> I want to give MyODBC another try. Can you please explain briefly where 
>>> you
>>> are using this code you sent me? What else do I need? Any tip you can 
>>> give
>>> me will be greatly appreciated.
>>>
>>> Thanks in advance,
>>> Daniel Levy
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "古雷" <[EMAIL PROTECTED]>
>>> To: "Daniel Levy" <[EMAIL PROTECTED]>; "Paun" <[EMAIL PROTECTED]>
>>> Cc: <[EMAIL PROTECTED]>
>>> Sent: Monday, February 06, 2006 3:09 AM
>>> Subject: Re: Unicode (UTF-8) question
>>>
>>>
>>>>>>> I have tried setting the character set of the table to utf8, and the
>>>>>>> specific column character set to utf8. I've also tried configuring 
>>>>>>> the
>>>>>>> ODBC's Connect Options to 'set names utf8';
>>>> How did you configure that option?
>>>> This is my may:
>>>>        SQLHSTMT hstmtset;
>>>>        SQLINTEGER rc;
>>>>        rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmtset);
>>>>        if(rc<0)
>>>>        {
>>>>            ostringstream err;
>>>>            err<<"SQLAllocHandle (SQL_HANDLE_STMT, hdbc, 
>>>> &hstmtset)"<<endl;
>>>>            err<<getSQLError(SQL_HANDLE_STMT,hstmtset);
>>>>            throwExecption(__FILE__,__LINE__,err.str());
>>>>        }
>>>>        char setnames[]="SET names utf8";
>>>>        rc = 
>>>> SQLExecDirect(hstmtset,(SQLCHAR*)setnames,sizeof(setnames)-1);
>>>>        if(rc<0)
>>>>        {
>>>>            ostringstream err;
>>>>            err<<setnames<<endl;
>>>>            err<<getSQLError(SQL_HANDLE_STMT,hstmtset);
>>>>            throwExecption(__FILE__,__LINE__,err.str());
>>>>        }
>>>> Our C/C++ application reads and writes utf8 Chinese with myODBC3.51. Our
>>>> java application connect to MYSQL with JDBC. Both of them and MySQL 
>>>> Query
>>>> Browser can get correct Chinese from MySQL.
>>>>
>>>> Moreover, MySQL can convert character set between GB2312 and UTF-8. If 
>>>> my
>>>> program SQLExecDirect "SET NAMES gb2312", it can read and write GB2312
>>>> Chinese from and to MySQL correctly even the columns' character set is
>>>> utf8.
>>>>
>>>> regards,
>>>> gu lei
>>> 
>

Reply via email to