List:General Discussion« Previous MessageNext Message »
From:Elizabeth Bonifacio Date:June 24 2005 8:48am
Subject:Re: connection error from c application
View as plain text  
Dear Gleb,

Thanks, i will try that as well, so far my program can access the
server now by using the old password. Now my problem is when i load
file, its only reading the first line and some more insert a null
record before the ist record.

here is the result i get after loading the text file:
mysql> load data local infile 'syslog5.txt' into table log4 fields
terminated by ' \t' lines terminated by '\n';
Query OK, 2 rows affected, 513 warnings (0.03 sec)
Records: 20  Deleted: 0  Skipped: 18  Warnings: 505

the first record shows all null values on all columns
the second record is correct but it is the first line in my text file
the rest of the lines in the text file is ignored.

I tried creating a table for my pc event logs, its all working fine,
can load, and query from the c application.

Would appreciate if you guys can help.

Elizabeth



On 6/23/05, Gleb Paharenko <gleb.paharenko@stripped> wrote:
> Hello.
> 
> 
> 
> I've compiled your code using libraries and includes from
> 
> MySQL-4.1.6 (yes, my testing environment isn'tperfect :) and
> 
> successfully connected to MySQL-4.1.10. Old passwords was off,
> 
> so I used a 4.1. authorization protocol.
> 
> 
> 
> 
> 
> Elizabeth Bonifacio <betcha.b@stripped> wrote:
> 
> > Dear All,
> 
> >
> 
> > I'm new into mysql and has been encountering huge problem in
> 
> > connecting to the database from the c application. The code execute
> 
> > with an error message :
> 
> > Failed to connect to database: Error:
> 
> > Client does not support authentication protocol requested by server;
> 
> > consider upgrading MySQL client
> 
> > Is this a bug?
> 
> >
> 
> > I'm running the MySql server version 4.1 with server and client both
> 
> > on same computer running on windows XP.
> 
> >
> 
> > I have no problem connecting to the server using root with a windfall
> 
> > password but  I cannot connect from the c application below.
> 
> >
> 
> > I have only one user in the server (root,windfall) and has been
> 
> > successful in accessing mysql from the client side except when
> 
> > connecting from a c application.
> 
> >
> 
> > here is the application which I compile using Visual C++ compiler:
> 
> >
> 
> > #include "stdio.h "
> 
> > #include "winsock.h"
> 
> > #include "iostream.h "
> 
> >
> 
> > #include "mysql.h"
> 
> >
> 
> > int main()
> 
> > {
> 
> >
> 
> > MYSQL mysql;
> 
> > MYSQL_ROW row;
> 
> > MYSQL_RES *result;
> 
> >
> 
> > unsigned int num_fields;
> 
> > unsigned int i;
> 
> > int num =3D 0;
> 
> > int iRetValue =3D 0;
> 
> >
> 
> > mysql_init(&mysql);
> 
> > //printf("%s",&mysql );
> 
> >
> 
> > if (!mysql_real_connect(&mysql,"localhost","root","windfall","mysql",3306,
> 
> > NULL,0))
> 
> > {
> 
> > fprintf(stderr, "Failed to connect to database: Error: \n%s\n",
> 
> > mysql_error(&mysql));
> 
> > }
> 
> > else
> 
> > {
> 
> > printf("SUCCESS\n");
> 
> > iRetValue =3D mysql_query(&mysql, "SELECT * FROM user");
> 
> >
> 
> > if( iRetValue !=3D 0 )
> 
> > {
> 
> > printf("Query Not Executed Properly.Please Check The Syntax.\n");
> 
> > }
> 
> > //here goes the error message :o)
> 
> > else
> 
> > {
> 
> > result =3D mysql_store_result(&mysql);
> 
> >
> 
> > num =3D mysql_field_count(&mysql);
> 
> > printf("Number Of Rows :%d\n",num );
> 
> >
> 
> > num_fields =3D mysql_num_fields( result);
> 
> > printf("Number Of Coloumns :%d\n",num_fields );
> 
> >
> 
> > while ((row =3D mysql_fetch_row(result)))
> 
> > {
> 
> > unsigned long *lengths;
> 
> > lengths =3D mysql_fetch_lengths(result);
> 
> >
> 
> > for(i =3D 0; i < num_fields; i++)
> 
> > {
> 
> > printf("[%.*s] \t", (int) lengths[i], row[i] ? row[i] : "NULL");
> 
> > }
> 
> > printf("\n");
> 
> > }
> 
> > }
> 
> > }
> 
> > }
> 
> >
> 
> > I would appreciate if you guys can help. thanks.
> 
> >
> 
> > Elizabeth
> 
> >
> 
> 
> 
> --
> For technical support contracts, goto https://order.mysql.com/?ref=ensita
> This email is sponsored by Ensita.NET http://www.ensita.net/
>   __  ___     ___ ____  __
>  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
>  / /|_/ / // /\ \/ /_/ / /__   Gleb.Paharenko@stripped
> /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
>       <___/   www.mysql.com
> 
> 
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 
>
Thread
connection error from c applicationElizabeth Bonifacio23 Jun
  • Re: connection error from c applicationKishore Jalleda23 Jun
  • Re: connection error from c applicationGleb Paharenko24 Jun
    • Re: connection error from c applicationElizabeth Bonifacio24 Jun
      • Re: connection error from c applicationGleb Paharenko24 Jun
      • Re: connection error from c applicationGleb Paharenko27 Jun
        • Re: connection error from c applicationElizabeth Bonifacio29 Jun
          • Re: connection error from c applicationKristen G. Thorson29 Jun