MySQL C API problems

2005-03-25 Thread Andrew Prock

I'm having some difficulty with a program I wrote
which uses the MySQL C api.  I'm trying to migrate
my server from version 4.0 to version 4.1.

I have no difficulty connecting to the server using
the mysql.exe command line utility, but when I try to
connect from my program using the same parameters,
it fails to connect with the Error 1045 (Access denied
for user).

I use the mysqlclient.lib library to link to my
windows program.  The library I have is a bit old, but
I can't seem to figure out which version it is easily.

Is the solution as simple as getting the new developers
libraries?

Specific versions are below.

works with   : 4.0.16-standard server
doesn't work with: 4.1.7-standard  server



- Andrew

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



Re: MySQL C API problems

2005-03-25 Thread Andrew Prock
On Fri, 25 Mar 2005, Michael Stassen wrote:

 Password hashing was changed in 4.1 to improve authentication security, but
 this complicates backward compatibility.  See the manual for details:
 http://dev.mysql.com/doc/mysql/en/old-client.html
 http://dev.mysql.com/doc/mysql/en/password-hashing.html

 Your best bet is to link your app against the 4.1 client library.

I just tried this.  Or I think I did.  I uninstalled, and
reinstalled mysql v4.1.10a, which I assume has the 4.1
client library.  I recompiled, relinked, and I get the
same error.  Again, I can connect using the mysql CLI, it's
just connecting through the API which is giving me problems.

I can connect to the 4.1.1 server with the mysql CLI, but
only the 4.0 server with the API.  I did have to make one
minor change to the code to get it to recompile.  Is there
some other API issue which I need to be aware of?

The code I use to connect is:



  _mysqlconn = mysql_init (NULL);
  if (_mysqlconn == NULL)
{
  print_error (NULL, mysql_init() failed (probably out of memory));
  return -1;
}

  /* connect to server */
  if (mysql_real_connect (_mysqlconn, host_name, user_name, password,
  database_name, opt_port_num, opt_socket_name,
  opt_flags) == NULL)
{
  print_error (_mysqlconn, mysql_real_connect() failed);
  mysql_close (_mysqlconn);
  _mysqlconn = NULL;
  return -1;
}


And the failure occurs during mysql_real_connect with error 1045
Access denied for user: and not the

Client does not support authentication protocol requested
 by server; consider upgrading MySQL client

that the web-page indicates that I might expect.  Again, I
*can* connect with the mysql CLI, it is only from the API
where I'm having difficulty.

Referencing the web page, it appears that the 4.1 server is
using 16-byte passwords, and not the 41-byte passwords.  It
might be that the server was started with --old-passwords
option, but how can I find out if that is the case?

It might be that the API is generating long password values,
when I need short password values.  Can I control this behaviour
through the API?

- Andrew


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



Re: MySQL C API problems

2005-03-25 Thread Andrew Prock
On Fri, 25 Mar 2005, Andrew Prock wrote:

 On Fri, 25 Mar 2005, Michael Stassen wrote:

  Password hashing was changed in 4.1 to improve authentication security, but
  this complicates backward compatibility.  See the manual for details:
  http://dev.mysql.com/doc/mysql/en/old-client.html
  http://dev.mysql.com/doc/mysql/en/password-hashing.html
 
  Your best bet is to link your app against the 4.1 client library.

Thank you for your assitance.  I have determined that
amidst all my horrid code there is a bug that is
totally unrelated to MySQL, and it's version number,
but that was related to port numbers.  Since both
servers are at the same domain, they are accessed
through different ports, and while I thought I was
handling ports correctly, I was always using the
default port.

Thanks again,

- Andrew


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