I've configured MySql to use SSL and it worked well in PHP. But when i'm trying to connect to the databases with a C/C++ program, it doesn't work.
host = "localhost"
psw = "pass"
db = "database"
usr = "userNOSSL"
conn = mysql_init(NULL);
mysql_real_connect(conn, host, usr, psw, db, 0, NULL, 0);
This one worked well. i can easily retrieve data with :
query = "SELECT x FROM y"
mysql_query(conn, query);
result = mysql_store_result(conn);
num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
for(i = 0; i < num_fields; i++)
{
printf("%s ", row[i] ? row[i] : "NULL");
}
printf("\n");
}
mysql_free_result(result);
usr = "userSSL"
conn = mysql_init(NULL);
mysql_real_connect(conn, host, usr, psw, db, 0, NULL, CLIENT_SSL);
The Error
Error : my "MYSQL *conn;" object is not getting parameters like "without ssl". so, it occurs an exception :
A first chance of exception at 0x0f18c274 in test_Class.exe : 0xC0000005:
Acces violation when reading on location 0x00000048.
An unhandled exception at 0x0f18c274 in test_Class.exe : 0xC0000005:
Acces violation when reading on location 0x00000048.
at this line :
num_fields = mysql_num_fields(result);
Same error if i do :
mysql_ssl_set(.SOMEOPTIONTHERE.)
mysql_real_connect(conn, host, usr, psw, db, 0, NULL, 0);
Thanks in advance.
My guess is that your local host isn't set up correctly to handle SSL. Try this: http://www.chriscalender.com/?tag=ssluserlocalhost
User contributions licensed under CC BY-SA 3.0