MYSQL Access Violation Writing Error
Posted by: shahzaib khan
Date: May 24, 2010 05:23AM

I am in very difficult situation while connecting with MYSQL dabatase , Trying to find some solution but can't get around . hopefully some has some idea to tell me what is going on and how to correct it.


I am using VC++ IDE , My Main program creats Two Threads . each thread performs a function and write the result in the database,

I have written class which interacts with MYSQL database , so i create two objects of mydatabase class and give it to each thread to access the database...

The Problem is after some time ( 3 - 5 minutes) its end up with an Error saying
---- Access Violation Writing Error. -----
and there is no futher message which can help me to find out what the problem is ...
I started to investigate and find out the problem could possibly be in the MYSQL *conn ...

currently class is like this


class myslq{
private :
MYSQL *conn

public :
void initMyDatabase();
void insertRecord (char *)
}

so in the function is initialize the conn and make connection .and keep the connection open until the program terminates ( Main Program is in infinite loop so not suppose to be ending )

what i did is changed the MYSQL *conn from being Global to Local so now i initiates the MYSQL conn structure inside the insertRecord function and close it before leaving the function. ... now doing this does stop the error message of "Access Violation Error" but starting to have different issue that most of the connection going on TIME_WAIT state and some of them shown ESTABLISHED . and after two days of running the program continuously MYSQL server said TOO MANY CONNECTIONS. and i simply can't access the database until i kill some connections.
Does any one has any idea what could possible be wrong in this situation. reply will deeply be appreciated.

Options: ReplyQuote


Subject
Written By
Posted
MYSQL Access Violation Writing Error
May 24, 2010 05:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.