Mydac Embeded example does not work when charset set to gbk

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vga
Posts: 58
Joined: Sat 08 Jul 2006 12:04

Mydac Embeded example does not work when charset set to gbk

Post by vga » Tue 16 Sep 2008 05:18

I run the mydac embeded example, when charset set to nothing and unicode to false, it work fine, but my data is utf8 charset, so, i try to change the charset and unicode value, then it does not work!
why?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 16 Sep 2008 12:49

The thing is that Unicode is supported by MySQL Embedded server version 5.0 and higher (e.g. 5.1.22-rc).
In order to use the UTF8 characters in tables you should specify the corresponding parameter on creating table, like this:

Code: Select all

CREATE TABLE TableName (
  Id INT PRIMARY KEY,
  ...
) CHARACTER SET utf8 COLLATE utf8_bin;

vga
Posts: 58
Joined: Sat 08 Jul 2006 12:04

Post by vga » Thu 18 Sep 2008 04:06

I change the script:


CREATE TABLE EMP (
EMPNO INT PRIMARY KEY,
ENAME VARCHAR(10),
JOB VARCHAR(9),
MGR INT,
HIREDATE DATETIME,
SAL FLOAT,
COMM FLOAT,
DEPTNO INT REFERENCES DEPT
) CHARACTER SET utf8 COLLATE utf8_bin;

INSERT INTO EMP VALUES
(7369,'SMITH','CLERK',7902,'1980-12-17',800,NULL,20);

INSERT INTO EMP VALUES
(7499,'ALLEN','SALESMAN',7698,'1981-2-20',1600,300,30);

INSERT INTO EMP VALUES
(7521,'WARD','SALESMAN',7698,'1981-2-22',1250,500,30);

INSERT INTO EMP VALUES
(7566,'JONES','MANAGER',7839,'1981-4-2',2975,NULL,20);

INSERT INTO EMP VALUES
(7654,'MARTIN','SALESMAN',7698,'1981-9-28',1250,1400,30);

INSERT INTO EMP VALUES
(7698,'BLAKE','MANAGER',7839,'1981-5-1',2850,NULL,30);

INSERT INTO EMP VALUES
(7782,'CLARK','MANAGER',7839,'1981-6-9',2450,NULL,10);

INSERT INTO EMP VALUES
(7788,'SCOTT','ANALYST',7566,'1987-7-13',3000,NULL,20);

INSERT INTO EMP VALUES
(7839,'KING','PRESIDENT',NULL,'1981-11-17',5000,NULL,10);

INSERT INTO EMP VALUES
(7844,'TURNER','SALESMAN',7698,'1981-9-8',1500,0,30);

INSERT INTO EMP VALUES
(7876,'ADAMS','CLERK',7788,'1987-7-13',1100,NULL,20);

INSERT INTO EMP VALUES
(7900,'JAMES','CLERK',7698,'1981-12-3',950,NULL,30);

INSERT INTO EMP VALUES
(7902,'FORD','ANALYST',7566,'1981-12-3',3000,NULL,20);

INSERT INTO EMP VALUES
(7934,'MILLER','CLERK',7782,'1982-1-23',1300,NULL,10);

and then delete the test dir,
set the connection charset option to utf8, and run the example, Error occured when click open button

vga
Posts: 58
Joined: Sat 08 Jul 2006 12:04

Post by vga » Fri 19 Sep 2008 10:25

it does not work.


thanks.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 19 Sep 2008 10:58

Was the problem solved? If any other questions come up, please contact me.

vga
Posts: 58
Joined: Sat 08 Jul 2006 12:04

Post by vga » Fri 19 Sep 2008 22:47

I could not make it work up to now.

help me please.

thanks

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 22 Sep 2008 12:39

Please supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL Embedded server.

vga
Posts: 58
Joined: Sat 08 Jul 2006 12:04

Post by vga » Tue 23 Sep 2008 05:05

delphi 7.0
mydac 5.55037
MySQL embeded server version: 5.0.9-beta-embedded-log

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 23 Sep 2008 07:23

I could not reproduce the problem.
Please use the MyDAC Embedded demo. Delete from the 'Embedded' directory 'share' and 'data' directories. Copy the 'share' directory from the MySQL server directory version 5.0.9 to 'Embedded'. Copy libmysqld.dll version 5.0.9-beta-embedded-log to 'Embedded'. Check that in the {Windows} directory the my.ini file does not exist.
After that run the Embedded demo and check its work.

vga
Posts: 58
Joined: Sat 08 Jul 2006 12:04

Post by vga » Tue 23 Sep 2008 11:44

It did work now.

there is a my.ini file in the windows folder.

thank you.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 23 Sep 2008 13:51

It is good to see that this problem has been solved.

Post Reply