Results 1 to 1 of 1
Mar 31, 2005, 10:56 #1
mysql_real_connect() breaks in libmysqld trying to access a distant server
Message may be long, but in short, I think there is a bug in libmysqld when it comes to use mysql_real_connect() to connect to a distant server.
I've wanted to embed the MySQL server into my application built with the Microsoft Development Environment 2003 - Visual C++ and it worked very fine. libmysqld works well in it to use with a database embedded into the machine where the application is running.
Documentation tells that it is still possible "to connect to an external server without starting the embedded server", by specifying a negative value for argc in mysql_server_init() (or mysql_library_init()). That way, it would be transparent for me to either use libmysql or libmysqld to connect to a distant server and I won't have to deliver two versions of my application.
Problem is: using a different DLL (libmysql) instead of the embedded server (libmysqld), I can easily connect to a distant server, but I can't with libmysqld, it just breaks when I call mysql_real_connect(). It returns me a message like:
First-chance exception at 0x7c918fea in testmysql.exe: 0xC0000005: Access violation writing location 0x00000010.
Unhandled exception at 0x7c918fea in testmysql.exe: 0xC0000005: Access violation writing location 0x00000010.
The program ' testmysql.exe: Native' has exited with code 0 (0x0).
Addresses look weird, seems unaligned... :s
For me, I thought the only difference between an application linked with libmysqld and libmysql is that the first is capable of being a server as well as a client (libmysqld) and the second is purely a client (libmysql). Am I right on this? Or is my DLL wrong?
I'm using the embedded version libmysqld in MySQL 4.1.10, I've tried both debug and release DLLs and both are returning the same error, without any error message.
Tell me if I'm wrong posting this message here. I didn't wanted to post a new bug entry because I'm quite a newbie at embedding DLLs in C++ applications and I may have miss something.