C++ connect to MySQL
I have a program that access MySQL.
I use the following method to connect to MySQL.
When I run this program, I monitor the memory usage through Task Manager,
HENV hEnv = NULL;
HDBC hDBC = NULL;
char* szUserName = (char*) sLogin.c_str();
char* szPassword = (char*) strdbPassword.c_str();
char* szDNS = (char*) sDSN.c_str();
SQLAllocConnect (hEnv, &hDBC);
retcode = SQLConnect (hDBC, (UCHAR*)szDNS, SQL_NTS, (UCHAR*) szUserName, SQL_NTS, (UCHAR*)szPassword, SQL_NTS);
if (retcode1 == SQL_SUCCESS || retcode1 == SQL_SUCCESS_WITH_INFO)
printf("Database connect sucessfully.\n");
printf("Database connect fail.\n");
SQLDisconnect( hDBC );
SQLFreeConnect( hDBC );
SQLFreeEnv( hEnv );
while( 1 )
I found that the memory usage will increase.
I have done some reserch about the ODBC connection method, some claim that this method will cause memory leak some how.
Can anyone help me on this?
> Can anyone help me on this?
Maybe post it on the MySQL forum where there are likely to be a high concentration of people with vastly more experience of MySQL.