mm wrote:
Dear friends,
This is my first cpp module working with mySQL.
It looks like the error is located in
MYSQL *m=mysql_real_connect(myDB, host, user, passwd, ...
There is a way to find out step by step which parameters is wrong?
I am working with Fedora core 3
and MySQL 3.23.58
Thanks,
MT

++++++++++++++++++ CPP module +++++++++++++++++++++++++++++++++++++++
#include "/usr/include/mysql/mysql.h"


int modulMySQL() {
printf("modulMySQL 01\n"); fflush(stdout);
// MYSQL *mysql_init(MYSQL *mysql)
// ===========================================
MYSQL *myDB;
MYSQL *mysql_init(myDB);
printf("modulMySQL 02\n"); fflush(stdout);


// MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char
//  *user, const char *passwd, const char *db, unsigned int port,
//  const char *unix_socket, unsigned long client_flag)
// ====================================================================
char *host=NULL, user[]="myname", passwd[]="mypass";
char db[]="ro";


unsigned int port=3306;
const char *unix_socket=NULL;
unsigned long client_flag=0;
MYSQL *m=mysql_real_connect(myDB, host, user, passwd,
db, port, unix_socket, client_flag);

http://dev.mysql.com/doc/mysql/en/mysql-real-connect.html

both your host _and_ unix_socket are null, this could not work if I understand well the doc. Use either "127.0.0.1" for host if networking is enable in mysql, or the full path to the unix socket (defaut /var/lib/mysql/mysql.sock)

--
Philippe Poelvoorde
COS Trading Ltd.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to