What is wrong with my code?
am 20.06.2007 17:40:52 von Ahmed Han------=_Part_120242_22945725.1182354052224
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
>
> #define _WIN32_IE 0x0601
>
#define _WIN32_WINNT 0x0501
> #include
> #include
> #include
> #include "mysql\mysql.h"
> using namespace std;
>
> int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR szParam, int
> nFunster)
> {
> MYSQL *conn, mysql;
> bool bConnected = FALSE;
> mysql_init(&mysql);
>
> conn = mysql_real_connect(&mysql, "db4free.net", "user", "pass",
> "default_db", 0, NULL, 0);
> if (conn == NULL)
> {
> cout << "Error occured while connecting.\n";
> cout << "Error code : " << mysql_errno(&mysql) << endl;
> cout << "Error string : " << mysql_error(&mysql) << endl;
> }
> else
> {
> bConnected = TRUE;
> cout << "Connected successfully.\n";
> }
>
> if (bConnected) mysql_close(&mysql);
>
> system("\nPAUSE");
> return EXIT_SUCCESS;
> }
>
When I compile and run the code below, I get an error message like this :
> File 'c:\mysql\\share\charsets\?.conf' not found (Errcode: 2)
> Character set '#33' is not a compiled character set and is not specified
> in the
> 'c:\mysql\\share\charsets\Index' file
> Error occured while connecting.
> Error code : 1251
> Error string : Client does not support authentication protocol requested
> by serv
> er; consider upgrading MySQL client
> Press any key to continue . . .
>
Notice the double backslashes in the path strings "c:\mysql\\share\charse...".
Is that normal?
I looked for sample codes by using Google, and all the example codes I found
are similar to mine.
Maybe one small difference is the use of mysql_init(); function. In some
examples it is used in this way :
mysql = mysql_init(NULL);
Bu I don't think it is what causing the problem.
What should I do to get rid of this problem?
Am I doing something wrong?
------=_Part_120242_22945725.1182354052224--