BDS 2006 and MySQL 5.0

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Aquineas
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 17.12.2005, 00:17

BDS 2006 and MySQL 5.0

Post by Aquineas »

Hey folks, newbie Zeos user here. I'm using the release version of BDS 2006 (C++ Builder Personality), and I just made a simple form with a "Connect" button. I basically connect (successfully) to the database, and when the form is shutting down (in a Close event), I disconnect (if connected).

I reach the destructor of my form, but for some reason the application isn't shutting down completely, and in the past when I've seen stuff like this, it's usually been thread related.

  • Has anyone run into this?
  • Is there anyplace in Zeos that there's threading code I could possilby look at to help determine the problem? I'm really not sure if the problem is here or in the MySQL 5.0.16 client driver
  • Could the fact that I'm running a dual core setup be exposing some previously unknown threading issue?
Aquineas
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 17.12.2005, 00:17

Post by Aquineas »

More data points. I used the built-in dbExpress driver to connect to the database and disconnect at form closing (basically the same thing I was doing with Zeos), and I see the same number of spawned threads created at connection time (five), but shutdown happens gracefully.

My suspicion is that somehow the call to shutdown mysql isn't happening. Is this something I typically need to do manually? This could be an iD10T programmer error on my part...
Aquineas
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 17.12.2005, 00:17

Post by Aquineas »

Okay, so I've done some more research into this. Apparently, I'm not the only one with this problem:


I wrote a standalone "C" app using VS2005 against libmysql, and verified that after closing a database, those same threads are still left laying around. So something in the mysql client library is causing this. I looked through the mysql.h header file and found entries for initializing and terminating a thread:

Code: Select all

/*
  Set up and bring down a thread; these function should be called
  for each thread in an application which opens at least one MySQL
  connection.  All uses of the connection(s) should be between these
  function calls.
*/
my_bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void);
BINGO!! I thought to myself; just make sure I call that mysql_thread_end() method, and those pesky little threads will go away. Unfortunately, that's not how it's working. So this is obviously something either I'm doing wrong or something wrong in the mysql library, but it boggles my mind that more people aren't running into this.. Or are you running into it and just don't know?

Note one difference between the Borland executable and the Microsoft one is that the Microsoft executable will still close with the running threads, whereas the Borland one won't.
killerjohn
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 23.11.2005, 09:19

Post by killerjohn »

I've the same problem, with WinXP SP2, MySQL 5.0.15 and Delphi 7 :(
But in my VMWare VM (WinXP SP2, MySQL 5.0.15, D7) and on other machines this problem isn't exists... :?
killerjohn
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 23.11.2005, 09:19

Post by killerjohn »

How can U install Zeos under D2006 ??? I've "invalid pointer operation" message :(
tygrys
Junior Boarder
Junior Boarder
Posts: 33
Joined: 09.12.2005, 18:31
Location: Poland

Post by tygrys »

Please check this forum thread

tygrys
Post Reply