Toon posts:

[VC++] connecten naar MySQL*

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik ben bezig een MySQL dbase te benaderen met C++ Ik gebruik MS Visual C++ 6.0. En heb de libraries van MySQL al toegevoegd. Ik heb echter last van een access violation zodra ik het volgende probeer te runnen:

C++:
1
2
3
4
5
6
7
8
9
10
11
#include <windows.h>
#include <mysql.h>

int main(int argc, char* argv[])
{
    MYSQL *conn = NULL;
    mysql_init(conn);
    mysql_real_connect(conn,"localhost","root","","forum",0,0,0);
    mysql_close(conn);
    return 0;
}


Hij gaat fout bij mysql_real_connect(). Heeft iemand enig idee waar de fout in kan liggen? Ik heb eerder problemen gehad dat ie libmySQL.lib niet kon vinden, maar heb dit opgelost(?) door deze in de windows/system dir te gooien. Nu geeft ie een andere foutmelding.

Dit zegt de debug
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\libmySQL.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\wsock32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\mswsock.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\dnsapi.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\winrnr.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\wldap32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\rasadhlp.dll', no matching symbolic information found.
First-chance exception in Kassa.exe (LIBMYSQL.DLL): 0xC0000005: Access Violation.

  • whoami
  • Registratie: December 2000
  • Laatst online: 17:38
Wat doet die mysql_init met die conn?

Moest ik jou zijn, dan zou ik checken of conn niet null is voor je mysql_real_connect doet.

https://fgheysels.github.io/


Verwijderd

Topicstarter
I luv U _/-\o_