At 19:07 -0700 4/20/04, <[EMAIL PROTECTED]> wrote:
I am attempting to write a C program to access MySQL. When I run this program, it reports that mysql_init() returned NULL, mysql_errno returned zero, and mysql_error returned "".
Here is the program:
#include <stdio.h>
#include <mysql/mysql.h>


int main( void )
{
        MYSQL *db;

        db = mysql_init( NULL );
        if (db == NULL);

I suggest you remove the semicolon at the end of the preceding line.



        {
                fprintf( stderr, "Error: _init() %d '%s'\n",
                        mysql_errno( db ), mysql_error( db ) );
                return 1;
        }
        mysql_close( db );
        return 0;
}

Build command: gcc mysql.c -lmysqlclient
OS: SuSE Linux 9.0
MySQL components installed:
MySQL-devel-4.0.18-0
MySQL-client-4.0.18-0
MySQL-shared-4.0.18-0
MySQL-server-4.0.18-0
MyODBC-3.51.06-1

I have not been able to find any reference to this issue.
I am able to access the server on this system using the "mysql" tool and using OpenOffice. For this reason, I don't figure I am out of memory [the only documented error for mysql_init()].


--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

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



Reply via email to