[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql-win32
Subject: What is wrong with my code?
From: "Ahmed Han" <ahmedhan () gmail ! com>
Date: 2007-06-20 15:40:52
Message-ID: 7c9dce210706200840l3564e6b7v8336420c8a28d45e () mail ! gmail ! com
[Download RAW message or body]
>
> #define _WIN32_IE 0x0601
>
#define _WIN32_WINNT 0x0501
> #include <cstdlib>
> #include <iostream>
> #include <windows.h>
> #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?
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic