Hello again :-)

In my everlasting search for knowledge, I have come to the issue of databases. I am using MySQL on a FreeBSD box.

After some issues with include paths and libraries, I managed to get in contact with the database and retrieve some records so the program and database works. Time to combine with some of the other stuff I have learned:

When connecting to the database, I used the following:
if(!mysql_real_connect(connect,SERVER,USER,PASSWORD,DATABASE,0,NULL,0)){
 cout << "Oops: " << mysql_error(connect) << endl;
 return 1;
}

This works as it should and tells me if the connection fails (e.g. wrong password).

But if I do this instead:
  try{
   mysql_real_connect(connect,SERVER,USER,PASSWORD,DATABASE,0,NULL,0);
  }catch(...){
   cout << "Oops: " << mysql_error(connect) << endl;
   return 1;
  }

I get the following error: Segmentation fault (core dumped) (i.e. not the mysql error as expected).

What am I doing wrong?

Best regards
Stefan


Oh, and I still wonder why #include <mysql/mysql.h> doesn't work, but I have to use the -Ipath-to-mysql.h option?
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to