FAQ
I am having a problem with a simple connect to my mysql server on win2k
server. This code works on my XP box but I get an

Debug Assertion Failure
dbgheap.c
_crtisvalidheappointer

The group names show up correctly but once the last group in the db is
displayed in the messagebox i get the failure. Also, If i rem out
everything but

Connection conn(use_exceptions);
conn.real_connect(DB,HOST,USERNAME,PASSWORD,3306,(int)0,60,NULL);

conn.close();

I get the failure as well??????

The code is pretty simple.

Thanks for any help
Jeff

try
{
Connection conn(use_exceptions);
conn.real_connect(DB,HOST,USERNAME,PASSWORD,3306,(int)0,60,NULL);
Query query = conn.query();
query << "select * from winmongroups";
Result res = query.store();

Row row;
Result::iterator i;

for(i = res.begin(); i != res.end(); i++)
{
row = *i;
MessageBox(row["groupname"]);
}

conn.close();
}
catch (BadQuery er)
{
MessageBox("bq");
}
catch (BadConversion er)
{
MessageBox("bc");
}



----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------

Search Discussions

  • Sinisa Milivojevic at Apr 20, 2004 at 9:47 am

    Jeff A Meyer wrote:
    I am having a problem with a simple connect to my mysql server on win2k
    server. This code works on my XP box but I get an

    Debug Assertion Failure
    dbgheap.c
    _crtisvalidheappointer

    The group names show up correctly but once the last group in the db is
    displayed in the messagebox i get the failure. Also, If i rem out
    everything but

    Connection conn(use_exceptions);
    conn.real_connect(DB,HOST,USERNAME,PASSWORD,3306,(int)0,60,NULL);

    conn.close();

    I get the failure as well??????

    The code is pretty simple.

    Thanks for any help
    Jeff

    try
    {
    Connection conn(use_exceptions);
    conn.real_connect(DB,HOST,USERNAME,PASSWORD,3306,(int)0,60,NULL);
    Query query = conn.query();
    query << "select * from winmongroups";
    Result res = query.store();

    Row row;
    Result::iterator i;

    for(i = res.begin(); i != res.end(); i++)
    {
    row = *i;
    MessageBox(row["groupname"]);
    }

    conn.close();
    }
    catch (BadQuery er)
    {
    MessageBox("bq");
    }
    catch (BadConversion er)
    {
    MessageBox("bc");
    }

    You do not need to use close() method with local object.

    If you get exception without it, use debugger. Also see if examples work.

    --

    Sincerely,

    --
    For technical support contracts, go to https://order.mysql.com/?ref=msmi
    __ ___ ___ ____ __
    / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <sinisa@mysql.com>
    / /|_/ / // /\ \/ /_/ / /__ MySQL AB
    /_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator
    <___/ www.mysql.com Larnaca, Cyprus
  • Jeff A Meyer at Apr 20, 2004 at 3:47 pm
    Sinisa
    Yes if I remove the conn.close I still get the error.
    If I simply put these 2 lines in the error occurs on 2k but not on XP.

    Connection conn(use_exceptions);
    conn.real_connect(DB,HOST,USERNAME,PASSWORD,3306,(int)0,60,NULL);

    The actual connection is made to the DB but on the close or destroy
    something is not a valid pointer.
    I can run through all the rows and entries just fine but on exit of the
    function or close of the DB
    I get the assertion failure.



    But, I did discover if I got without the classes this code works on both
    OS'.

    MYSQL *conn;
    conn = mysql_init(NULL);
    if((mysql_real_connect(conn,HOST,USERNAME,PASSWORD,DB,0,NULL,0)) == NULL)
    MessageBox("NULL");

    MYSQL_RES *res_set;
    MYSQL_ROW row;
    unsigned int i;
    mysql_query(conn,"SELECT * FROM winmonhosts order by devicename");
    res_set = mysql_store_result(conn);

    while((row = mysql_fetch_row(res_set)) != NULL)
    {
    CString cs;
    cs.Format("%s",row[1]);
    MessageBox(cs);
    }
    mysql_free_result(res_set);
    mysql_close(conn);


    I have seen discussion of the _crtisvalidheappointer error on the net and a
    lot say it will go away with the release compile but that is not the case
    with my issue.

    I have tried the code on 2 different win2k servers and both get the error.
    For now I will go with the class-less code because it seems to work on both
    OS'.

    Anyone have any ideas?

    Thanks
    Jeff
  • Sinisa Milivojevic at Apr 21, 2004 at 10:43 am

    Jeff A Meyer wrote:
    Sinisa
    Yes if I remove the conn.close I still get the error.
    If I simply put these 2 lines in the error occurs on 2k but not on XP.

    Connection conn(use_exceptions);
    conn.real_connect(DB,HOST,USERNAME,PASSWORD,3306,(int)0,60,NULL);

    The actual connection is made to the DB but on the close or destroy
    something is not a valid pointer.
    I can run through all the rows and entries just fine but on exit of the
    function or close of the DB
    I get the assertion failure.



    But, I did discover if I got without the classes this code works on both
    OS'.

    MYSQL *conn;
    conn = mysql_init(NULL);
    if((mysql_real_connect(conn,HOST,USERNAME,PASSWORD,DB,0,NULL,0)) == NULL)
    MessageBox("NULL");

    MYSQL_RES *res_set;
    MYSQL_ROW row;
    unsigned int i;
    mysql_query(conn,"SELECT * FROM winmonhosts order by devicename");
    res_set = mysql_store_result(conn);

    while((row = mysql_fetch_row(res_set)) != NULL)
    {
    CString cs;
    cs.Format("%s",row[1]);
    MessageBox(cs);
    }
    mysql_free_result(res_set);
    mysql_close(conn);


    I have seen discussion of the _crtisvalidheappointer error on the net and a
    lot say it will go away with the release compile but that is not the case
    with my issue.

    I have tried the code on 2 different win2k servers and both get the error.
    For now I will go with the class-less code because it seems to work on both
    OS'.

    Anyone have any ideas?

    Thanks
    Jeff

    The above can be resolved with debugger only.

    --

    Sincerely,

    --
    For technical support contracts, go to https://order.mysql.com/?ref=msmi
    __ ___ ___ ____ __
    / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <sinisa@mysql.com>
    / /|_/ / // /\ \/ /_/ / /__ MySQL AB
    /_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator
    <___/ www.mysql.com Larnaca, Cyprus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupplusplus @
categoriesmysql
postedApr 19, '04 at 5:42p
activeApr 21, '04 at 10:43a
posts4
users2
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2022 Grokbase