Hi
I'm working on a project in C with mysql and I'm having a problem connecting to the MySQL server. My first connection works. However,
in another section I also need to retrieve info from the database as well. I am using the same code to make this other connection.
conn = mysql_init(NULL);
if (conn == NULL)
{
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_real_connect(conn, "localhost", "test", "test", "test", 0, NULL, 0) == NULL)
{
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
}
When I use this a second time I get the following error:
Unhandled exception at 0x009818c9 in simple.exe: 0xC0000005: Access violation reading location 0x00000000.
it crashes on the
if(conn == NULL)
Does anyone have an idea why this doesn't work?
Thanks.