EAccessViolation in module libmysqld.dll

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

EAccessViolation in module libmysqld.dll

Post by wseifert »

Hi!

Using libmysqld.dll from MySQL 5.1 in my project I get 'accessviolation at address 01991FB9 in module 'libmysqld.dll' writing from address 000000054'.
This happens adding record to the database using ZDataSet.TZQuery.Open.

Changing the libmysqld to MySQL 4.1 everything works fine as expected.

I have searched for the embedded libmysqld.dll from MySQL 5.0, no success, I did find only archives with empty embedded directory, so I could not test the 5.0 version.

Any help welcome.

Regards
Werner
jeremicm
Senior Boarder
Senior Boarder
Posts: 61
Joined: 18.10.2006, 17:07
Contact:

Post by jeremicm »

I think You should use TZQuery.Execute; instead TZQuery.Open;
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

Post by wseifert »

jeremicm wrote:I think You should use TZQuery.Execute; instead TZQuery.Open;
TZQuery.Execute can only be used together with create, insert, .. (SQL queries which modifies table(s), TZQuery.Open is to use together with select, ...

In my case I cannot use Execute, I must use Open ...

If I use a remote Database (libmysql.dll versions 4.1, 5.0, 5.1) everything works as expected, only embedded libmysqld.dll version 5.1 has this issue.

Werner
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

Post by wseifert »

After some investigation I found some interesting facts at this issue:

It looks like that this problem is a thread related prob. In my app the part of the prog where the issue happens is a thread importing data into the database. This works fine using libmysql.dll connecting to a MySQL Database Server and using embedded server libmysqld.dll version 4.1x. But it is not working using libmysqld.dll versions 5.x. I have tested this changing the threaded part of the app into a non-threaded part and voilá, the error was gone. So I googled for libmysqld and thread and found http://forums.mysql.com/read.php?58,268 ... msg-268473, a topic with the same issue I have. The first answer to this post:
Problem resolved. All threads should call mysql_init(), mysql_options() and mysql_real_connect() to obtain their own MySQL object and own connection to the database in the thread procedure. Before the thread exits, it should call mysql_close() to disconnect.
It looks like that starting with MySQL version 5 threads should use their own connection, but I do not know if the embedded server alows this. I will try to test this next week, comments are welcome.

Werner
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

Post by wseifert »

I have solved the Issue >>EAccessViolation in module libmysqld.dll<<.

As I stated above I found a post on mysql forums in which the author suggests to put all mysql related stuff inside the thread procedure. I have done this and no Issue furthermore.

Werner
Post Reply