Hi All
Iam using the libmysql.lib in my C++ app, I have a mySQL database setup on a
remote server something.dyndns.org and using port 2000, I use the following
little bit of code to try and access the database but it just sits there and
does nothing. Iam I doing something wrong, not doing something or is there a
problem using libmysql with a C++ app. Any help would be great.
#include <windows.h>
#include <winsock2.h>
#pragma warning (disable: 4514 4786)
#pragma warning( push, 3 )
#define VERSION "4.1"
#endif
#pragma comment(lib, "libmysql.lib")
// SQL test
#include <MySQL.h>
void MySQLTest(void)
{
MYSQL *mysql = NULL;
MYSQL *connect = NULL;
//int timeout = 4;
mysql = mysql_init(NULL);
//mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&timeout);
connect = mysql_real_connect(mysql, "something.dyndns.org", "root", NULL,
"mysql", 2000, NULL, 0);
if ( !connect )
{
// Had a problem
Debug(("Failed to connect to database: Error: %s<br>\n",
mysql_error(mysql)));
}
else
{
Debug(("We connected to the SQL database<br>\n"));
}
mysql_close(mysql);
}
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 31/03/2004