On Tue, Sep 21, 2004 at 06:43:00PM +0300, Calin Vaida wrote:
> All have worked ok until i switch the sistem and the mysql++ driver
> to a new one. So my problem appear for the same application but
> running on a suse 9.1 with mysql++1.7.17 and using
> mysql-client-4.0.18-32 (that is the default on the suse 9.1 I guess).
> The problem appear when the mysql connection is closed and my whole
> application crash with SEG fault.
> The interesting thing is that on my sistem (suse 8.1) the same
> application with the mysql++1.7.17 is working properly.
Odd that mysql_close() seems to be called twice in the backtrace
you posted.
Anyway, did you compile mysql++ fresh on each system, or use the RPM's?
If you used the RPM, it might be worth trying compiling it from
source to make sure it is not a compiler incompatibility between
different versions of SuSe.
I found the sample code below at: http://bugs.mysql.com/bug.php?id=1424
If it really is a C lib bug, it should show up with this code.
- Chris
#include <mysql.h>
#include <stdio.h>
int main() {
int rc;
int i;
MYSQL *mysql;
mysql_server_init(0, NULL, NULL);
mysql = mysql_init(NULL);
if (mysql_real_connect(mysql, NULL, NULL, NULL, "", 0, NULL, 0) == NULL) {
printf("error\n");
}
if (mysql_errno(mysql)) {
printf("Error 1: %s\n", mysql_error(mysql));
mysql_close(mysql);
exit(-1);
}
mysql_close(mysql);
mysql_server_end();
}