Re: connection error from c application

2005-06-29 Thread Elizabeth Bonifacio
  Dear Guys,
  I have been stucked in loading file using load data local infile command.
At first it is loading a null value on my first record followed with
one record from my input file. The rest are ignored and i've been
receiving lots of warnings.

I tried converting the text file into a csv and was successful in
loading all the files but with a lot of null values and data going
another field. I used the fields terminated by ',' lines terminated
by ',' instead of '\r\n' because the loading problem.

I tried reformatting my txt and csv file, check its spacing(tabs) one
by one but still the data seem to go haywire.

 I'm actually building an application that will accept continuous data
(syslog) using c++ that I need to store in Mysql. But just want to
handle one thing at a time so I'm just testing how it will accept
loading file from the mysql prompt.

I'm running on windows XP, mysql server 4.1.11. Kindly refer to the
table structure and the attached file. I know you guys are experience
and must have encounter this matter before.

Will appreciate all your help to a new developer like me,

Thanks,

Elizabeth

mysql show create table log8;
| log8  |CREATE TABLE `log8` (
  `log_date` date default '-00-00',
  `log_time` time default '00:00:00',
  `device_id` varchar(17) default NULL,
  `log_id` varchar(11) NOT NULL default '',
  `type` varchar(7) default NULL,
  `subtype` varchar(7) default NULL,
  `pri` varchar(6) default NULL,
  `vd` varchar(4) default NULL,
  `serial_number` int(11) default NULL,
  `duration` int(5) default NULL,
  `policyid` tinyint(3) default NULL,
  `proto` tinyint(3) default NULL,
  `service` varchar(10) default NULL,
  `status` varchar(6) default NULL,
  `src` varchar(15) default NULL,
  `srcname` varchar(15) default NULL,
  `dst` varchar(15) default NULL,
  `dstname` varchar(15) default NULL,
  `src_int` varchar(8) default NULL,
  `dst_int` varchar(8) default NULL,
  `sent` int(11) default NULL,
  `rcvd` int(11) default NULL,
  `sent_pkt` tinyint(4) default NULL,
  `rcvd_pkt` tinyint(4) default NULL,
  `src_port` int(11) default NULL,
  `dst_port` int(11) default NULL,
  `vpn` varchar(5) default NULL,
  `tran_ip` varchar(15) default NULL,
  `tran_port` int(5) default NULL,
  `dir_disp` varchar(5) default NULL,
  `tran_disp` varchar(5) default NULL,
  PRIMARY KEY  (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
1 row in set (0.08 sec)

mysql

On 6/27/05, Gleb Paharenko [EMAIL PROTECTED] wrote:
 Hello.
 
 
 
 Send an example of your file and your table's definition
 
 (use SHOW CREATE TABLE for this purpose). Please, next time
 
 send your replies to the list.
 
 
 
 
 
 
 
 
 
 Hope you're doing great today. Back to my question last week, I've
 
 been encountering this problem of loading my file using the load data
 
 local infile command for a particular text file.
 
 
 
 I cannot determine the error in my sql codes since i find no problem
 
 loading other text file into the database.
 
 
 
  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
 
 
 
 
 
 I'm not familiar with this warnings myself. I can only load the
 
 first line in the syslog5.txt and the rest are ignored. From the two
 
 rows only the first line is stored and the rest are ignored.
 
 
 
 The result of my select statement from the log4 table includes all
 
 null value on the first row and the value of the second line for the
 
 second row.
 
 
 
 Would appreciate if you can teach me how to debug the warning or maybe
 
 enlighten me on the cause of the problem.
 
 
 
 Thanks for all your help.
 
 
 
 Elizabeth
 
 
 
 On 6/24/05, Gleb Paharenko [EMAIL PROTECTED] wrote:
 
 
 
  Hello.
 
 
 
 
 
 
 
  What 'SHOW WARNINGS' reports?
 
 
 
 Elizabeth Bonifacio [EMAIL PROTECTED] wrote:
 
 
 
 --
 For technical support contracts, goto https://order.mysql.com/?ref=ensita
 This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
  / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
 /_/  /_/\_, /___/\___\_\___/   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/[EMAIL PROTECTED]
 

6/23/2005   15:45:50FGT2002A0420075722010001traffic 
allowed notice  root3656393 180 1   17  53020/udp   accept  
192.168.2.6 192.168.2.6 83.217.132.783.217.132.7internal
external183 69  1   1   32193   53020   n/a 
202.189.48.98   61114   org noop
6/23/2005   15:45:50FGT2002A0420075722010001traffic 
allowed notice  root3655880 584 1   17  36480/udp   accept  
192.168.2.6 

Re: connection error from c application

2005-06-29 Thread Kristen G. Thorson

Your syslog8.txt file has two problems:

1.  The first field, log_date, is in m/d/ format.  It will not be 
converted by MySQL automatically.  It needs to be in -mm-dd format.  
For this reason, all records will have the default value of '-00-00' 
for that field.
2.  The primary key on your table is log_id.  In the sample you sent, 
all of the log_id's are the same.  The first row is inserted, and all 
others with that ID are skipped.




kgt





Elizabeth Bonifacio wrote:


 Dear Guys,
 I have been stucked in loading file using load data local infile command.
At first it is loading a null value on my first record followed with
one record from my input file. The rest are ignored and i've been
receiving lots of warnings.

I tried converting the text file into a csv and was successful in
loading all the files but with a lot of null values and data going
another field. I used the fields terminated by ',' lines terminated
by ',' instead of '\r\n' because the loading problem.

I tried reformatting my txt and csv file, check its spacing(tabs) one
by one but still the data seem to go haywire.

I'm actually building an application that will accept continuous data
(syslog) using c++ that I need to store in Mysql. But just want to
handle one thing at a time so I'm just testing how it will accept
loading file from the mysql prompt.

I'm running on windows XP, mysql server 4.1.11. Kindly refer to the
table structure and the attached file. I know you guys are experience
and must have encounter this matter before.

Will appreciate all your help to a new developer like me,

Thanks,

Elizabeth

mysql show create table log8;
| log8  |CREATE TABLE `log8` (
 `log_date` date default '-00-00',
 `log_time` time default '00:00:00',
 `device_id` varchar(17) default NULL,
 `log_id` varchar(11) NOT NULL default '',
 `type` varchar(7) default NULL,
 `subtype` varchar(7) default NULL,
 `pri` varchar(6) default NULL,
 `vd` varchar(4) default NULL,
 `serial_number` int(11) default NULL,
 `duration` int(5) default NULL,
 `policyid` tinyint(3) default NULL,
 `proto` tinyint(3) default NULL,
 `service` varchar(10) default NULL,
 `status` varchar(6) default NULL,
 `src` varchar(15) default NULL,
 `srcname` varchar(15) default NULL,
 `dst` varchar(15) default NULL,
 `dstname` varchar(15) default NULL,
 `src_int` varchar(8) default NULL,
 `dst_int` varchar(8) default NULL,
 `sent` int(11) default NULL,
 `rcvd` int(11) default NULL,
 `sent_pkt` tinyint(4) default NULL,
 `rcvd_pkt` tinyint(4) default NULL,
 `src_port` int(11) default NULL,
 `dst_port` int(11) default NULL,
 `vpn` varchar(5) default NULL,
 `tran_ip` varchar(15) default NULL,
 `tran_port` int(5) default NULL,
 `dir_disp` varchar(5) default NULL,
 `tran_disp` varchar(5) default NULL,
 PRIMARY KEY  (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
1 row in set (0.08 sec)

mysql

On 6/27/05, Gleb Paharenko [EMAIL PROTECTED] wrote:
 


Hello.



Send an example of your file and your table's definition

(use SHOW CREATE TABLE for this purpose). Please, next time

send your replies to the list.







   


Hope you're doing great today. Back to my question last week, I've
 


been encountering this problem of loading my file using the load data
 


local infile command for a particular text file.
 


I cannot determine the error in my sql codes since i find no problem
 


loading other text file into the database.
 


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
 


I'm not familiar with this warnings myself. I can only load the
 


first line in the syslog5.txt and the rest are ignored. From the two
 


rows only the first line is stored and the rest are ignored.
 


The result of my select statement from the log4 table includes all
 


null value on the first row and the value of the second line for the
 


second row.
 


Would appreciate if you can teach me how to debug the warning or maybe
 


enlighten me on the cause of the problem.
 


Thanks for all your help.
 


Elizabeth
 


On 6/24/05, Gleb Paharenko [EMAIL PROTECTED] wrote:
 


Hello.
 


What 'SHOW WARNINGS' reports?
 



Elizabeth Bonifacio [EMAIL PROTECTED] wrote:



--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
 __  ___ ___   __
/  |/  /_ __/ __/ __ \/ /Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   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/[EMAIL PROTECTED]

   



 



Re: connection error from c application

2005-06-27 Thread Gleb Paharenko
Hello.



Send an example of your file and your table's definition

(use SHOW CREATE TABLE for this purpose). Please, next time

send your replies to the list.









Hope you're doing great today. Back to my question last week, I've

been encountering this problem of loading my file using the load data

local infile command for a particular text file.



I cannot determine the error in my sql codes since i find no problem

loading other text file into the database.



 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





I'm not familiar with this warnings myself. I can only load the

first line in the syslog5.txt and the rest are ignored. From the two

rows only the first line is stored and the rest are ignored.



The result of my select statement from the log4 table includes all

null value on the first row and the value of the second line for the

second row.



Would appreciate if you can teach me how to debug the warning or maybe

enlighten me on the cause of the problem.



Thanks for all your help.



Elizabeth



On 6/24/05, Gleb Paharenko [EMAIL PROTECTED] wrote:



 Hello.







 What 'SHOW WARNINGS' reports?



Elizabeth Bonifacio [EMAIL PROTECTED] wrote:



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   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/[EMAIL PROTECTED]



Re: connection error from c application

2005-06-24 Thread Elizabeth Bonifacio
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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
  / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
 /_/  /_/\_, /___/\___\_\___/   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/[EMAIL PROTECTED]
 


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



Re: connection error from c application

2005-06-24 Thread Gleb Paharenko
Hello.



What 'SHOW WARNINGS' reports?





Elizabeth Bonifacio [EMAIL PROTECTED] wrote:

 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 [EMAIL PROTECTED] wrote:

 Hello.

=20

=20

=20

 I've compiled your code using libraries and includes from

=20

 MySQL-4.1.6 (yes, my testing environment isn'tperfect :) and

=20

 successfully connected to MySQL-4.1.10. Old passwords was off,

=20

 so I used a 4.1. authorization protocol.

=20

=20

=20

=20

=20

 Elizabeth Bonifacio [EMAIL PROTECTED] wrote:

=20

  Dear All,

=20

 

=20

  I'm new into mysql and has been encountering huge problem in

=20

  connecting to the database from the c application. The code execute

=20

  with an error message :

=20

  Failed to connect to database: Error:

=20

  Client does not support authentication protocol requested by server;

=20

  consider upgrading MySQL client

=20

  Is this a bug?

=20

 

=20

  I'm running the MySql server version 4.1 with server and client both

=20

  on same computer running on windows XP.

=20

 

=20

  I have no problem connecting to the server using root with a windfall

=20

  password but  I cannot connect from the c application below.

=20

 

=20

  I have only one user in the server (root,windfall) and has been

=20

  successful in accessing mysql from the client side except when

=20

  connecting from a c application.

=20

 

=20

  here is the application which I compile using Visual C++ compiler:

=20

 

=20

  #include stdio.h 

=20

  #include winsock.h

=20

  #include iostream.h 

=20

 

=20

  #include mysql.h

=20

 

=20

  int main()

=20

  {

=20

 

=20

  MYSQL mysql;

=20

  MYSQL_ROW row;

=20

  MYSQL_RES *result;

=20

 

=20

  unsigned int num_fields;

=20

  unsigned int i;

=20

  int num =3D3D 0;

=20

  int iRetValue =3D3D 0;

=20

 

=20

  mysql_init(mysql);

=20

  //printf(%s,mysql );

=20

 

=20

  if (!mysql_real_connect(mysql,localhost,root,windfall,mysql,33=

 06,

=20

  NULL,0))

=20

  {

=20

  fprintf(stderr, Failed to connect to database: Error: \n%s\n,

=20

  mysql_error(mysql));

=20

  }

=20

  else

=20

  {

=20

  printf(SUCCESS\n);

=20

  iRetValue =3D3D mysql_query(mysql, SELECT * FROM user);

=20

 

=20

  if( iRetValue !=3D3D 0 )

=20

  {

=20

  printf(Query Not Executed Properly.Please Check The Syntax.\n);

=20

  }

=20

  //here goes the error message :o)

=20

  else

=20

  {

=20

  result =3D3D mysql_store_result(mysql);

=20

 

=20

  num =3D3D mysql_field_count(mysql);

=20

  printf(Number Of Rows :%d\n,num );

=20

 

=20

  num_fields =3D3D mysql_num_fields( result);

=20

  printf(Number Of Coloumns :%d\n,num_fields );

=20

 

=20

  while ((row =3D3D mysql_fetch_row(result)))

=20

  {

=20

  unsigned long *lengths;

=20

  lengths =3D3D mysql_fetch_lengths(result);

=20

 

=20

  for(i =3D3D 0; i  num_fields; i++)

=20

  {

=20

  printf([%.*s] \t, (int) lengths[i], row[i] ? row[i] : NULL);

=20

  }

=20

  printf(\n);

=20

  }

=20

  }

=20

  }

=20

  }

=20

 

=20

  I would appreciate if you guys can help. thanks.

=20

 

=20

  Elizabeth

=20

 

=20

=20

=20

 --

 For technical support contracts, goto https://order.mysql.com/?ref=3Densi=

 ta

 This email is sponsored by Ensita.NET http://www.ensita.net/

   __  ___ ___   __

  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko

  / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]

 /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET

   ___/   www.mysql.com

=20

=20

=20

=20

 --

 MySQL General Mailing List

 For list archives: http://lists.mysql.com/mysql

 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

 m

=20



 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql

connection error from c application

2005-06-23 Thread Elizabeth Bonifacio
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 = 0;
int iRetValue = 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 = mysql_query(mysql, SELECT * FROM user);

if( iRetValue != 0 )
{
printf(Query Not Executed Properly.Please Check The Syntax.\n);
}
//here goes the error message :o)
else
{
result = mysql_store_result(mysql);

num = mysql_field_count(mysql);
printf(Number Of Rows :%d\n,num );

num_fields = mysql_num_fields( result);
printf(Number Of Coloumns :%d\n,num_fields );

while ((row = mysql_fetch_row(result)))
{
unsigned long *lengths;
lengths = mysql_fetch_lengths(result);

for(i = 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

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



Re: connection error from c application

2005-06-23 Thread Kishore Jalleda
I guess this is a problem with the version of the C client Libraries
that you are using, because of the way 4.1.x version of mysql stores
the hash value of the password using the PASSWORD( ) function, so when
you are giving the password embedded in the C code, may be the server
does not match it with the one stored byt it , you could try two
things i guess as per the

1) Upgrade all client programs to use the 4.1.1 or newer client library.  
Reset the user that needs a pre-4.1 client to use an old password: 
  mysql UPDATE user SET Password = OLD_PASSWORD('mypass')
  - WHERE Host = 'some_host' AND User = 'some_user';
  mysql FLUSH PRIVILEGES;
OR 

2) Tell the server to use the older password hashing algorithm: 
Start mysqld with --old-passwords. 
Set the password for all users that has a long password. You can find
these users with:
   SELECT * FROM mysql.user WHERE LEN(password)  16;
 
http://dev.mysql.com/doc/mysql/en/password-hashing.html

Hope this helps 

Kishore Jalleda 

On 6/23/05, Elizabeth Bonifacio [EMAIL PROTECTED] 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 = 0;
 int iRetValue = 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 = mysql_query(mysql, SELECT * FROM user);
 
 if( iRetValue != 0 )
 {
 printf(Query Not Executed Properly.Please Check The Syntax.\n);
 }
 //here goes the error message :o)
 else
 {
 result = mysql_store_result(mysql);
 
 num = mysql_field_count(mysql);
 printf(Number Of Rows :%d\n,num );
 
 num_fields = mysql_num_fields( result);
 printf(Number Of Coloumns :%d\n,num_fields );
 
 while ((row = mysql_fetch_row(result)))
 {
 unsigned long *lengths;
 lengths = mysql_fetch_lengths(result);
 
 for(i = 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
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 


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



Re: connection error from c application

2005-06-23 Thread Gleb Paharenko
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 [EMAIL PROTECTED] 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
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   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/[EMAIL PROTECTED]