MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:April Escamilla Date:June 9 1999 6:58pm
Subject:Re: mysql_real_connect problem??
View as plain text  
Hey Monty & Paul

    Thanks for the suggestions you two.  mysql_init is not in my version, so
I took it out, but mysql_real_connect is.  So i tweaked the code to fit the
specs in mysql.h but now I get this error.

april=/u/april [247]:cc -o mysql_connect
mysql_connect.c -ls -L/u/april/mysql -lmysq>
i386ld mysql_connect.o: can't find library libs.a
april=/u/april [248]:cc -o mysql_connect
mysql_connect.c -ls -L/u/april/mysql -lmysqlclient
i386ld mysql_connect.o: can't find library libs.a

   As you can see, I tried to link different headers... I'll paste in my
code again, in case it helps at all...


     1 #include </u/april/mysql/mysql.h>
     2  #include </u/april/mysql/mysql_com.h>
     3  #include </u/april/mysql/mysql_version.h>
     4  #include <stdio.h>
     /* some declarations */
     17 int main()
    18  {
    19    MYSQL *mysql;
    20
    21    if
(!mysql_real_connect(mysql,host,user,passwd,port,unix_socket,clientflag))
    22    {
    23      fprintf(stderr, "Failed to connect to database: Error:
%s\n",mysql_error(my
sql));
    24    }
    25    else
    26    {
    27      printf("Connected to database. \n");
    28    }
    29  } //end of main function

    ; )  Frustration on this end!   I appreciate any other ideas you two may
have regarding this problem..

Thank you,
April E.


-----Original Message-----
From: Michael Widenius <monty@stripped>
To: April Escamilla <aprile@stripped>
Cc: Paul DuBois <paul@stripped>; mysql@stripped
<mysql@stripped>
Date: Wednesday, June 09, 1999 1:07 PM
Subject: Re: mysql_real_connect problem??


>>>>>> "April" == April Escamilla <aprile@stripped>
> writes:
>
>April> Paul,
>April> Thanks very much for your quick responses and suggestions.  I went
ahead
>April> and tried the combination you suggested -- I deleted the db
argument, and
>April> tried to compile by specifying -lmysqlclient instead of -lmysql.
Here's
>April> what I got back
>
>April> #  cc -o mysql_connect mysql_connect.c -lc -lmysqlclient
>April> undefined                       first referenced
>April> symbol                             in file
>April> mysql_init                          mysql_connect.o
>April> mysql_real_connect                  mysql_connect.o
>April> i386ld fatal: Symbol referencing errors. No output written to
mysql_connect
>
>
>April> #cc -o mysql_connect
mysqlconnect.c -lc -L/u/april/mysql -lmysqlclient
>April> <
>April> undefined                       first referenced
>April> symbol                             in file
>April> mysql_init                          mysql_connect.o
>April> mysql_real_connect                  mysql_connect.o
>April> i386ld fatal: Symbol referencing errors. No output written to
mysql_connect
>
>
>April> Any thoughts on this, Paul, or anyone else?
>
>Hi!
>
>MySQL 3.21.x doesn't have the mysql_init call, so you can just remove
>from your code as follows:
>
>#if MYSQL_VERSION_ID >= 32200
>  mysql_init(&mysql);
>#endif
>
>You should however have the mysql_real_connect() in 3.21.33. Are you
>sure you are linking with the correct library?
>
>You can check that you have the real_connect_call by doing.
>
>nm libmysqlclient.a | grep mysql_real
>
>If this doesn't print anything, you should use the mysql_connect()
>call instead!
>
>Regards,
>Monty
>
>
>
>

Thread
mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
  • Re: mysql_real_connect problem??Michael Widenius9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Sasha Pachev9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
  • Re: mysql_real_connect problem??Paul DuBois10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla11 Jun
  • Re: mysql_real_connect problem??Sasha Pachev11 Jun