Page 1 of 1

Mydac Embeded example does not work when charset set to gbk

Posted: Tue 16 Sep 2008 05:18
by vga
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?

Posted: Tue 16 Sep 2008 12:49
by Dimon
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;

Posted: Thu 18 Sep 2008 04:06
by vga
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

Posted: Fri 19 Sep 2008 10:25
by vga
it does not work.


thanks.

Posted: Fri 19 Sep 2008 10:58
by Dimon
Was the problem solved? If any other questions come up, please contact me.

Posted: Fri 19 Sep 2008 22:47
by vga
I could not make it work up to now.

help me please.

thanks

Posted: Mon 22 Sep 2008 12:39
by Dimon
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.

Posted: Tue 23 Sep 2008 05:05
by vga
delphi 7.0
mydac 5.55037
MySQL embeded server version: 5.0.9-beta-embedded-log

Posted: Tue 23 Sep 2008 07:23
by Dimon
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.

Posted: Tue 23 Sep 2008 11:44
by vga
It did work now.

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

thank you.

Posted: Tue 23 Sep 2008 13:51
by Dimon
It is good to see that this problem has been solved.