Hi all,
I am having a bit of trouble and I am hoping a seasoned MonetDB expert can lend some advice.

I am using the MAPI interface in my C/C++ application to talk to my MonetDB instance. 
I have a recursive INSERT INTO statement which populates the database, and it initially works pretty well.

However, as I populate more (past 200 inserts in my case), I get a MAPI error (exampled by: mapi_explain_result()):

MAPI  = monetdb@localhost:50000
ACTION= mapi_start_talking
ERROR = !Connection terminated

No real reason as to why. Has anyone seen this before?

My code:

MapiHdl query(Mapi dbh, char *q)
{
    MapiHdl ret = NULL;
    if ((ret = mapi_query(dbh, q)) == NULL || mapi_error(dbh) != MOK)
        die(dbh, ret);
    return(ret);
}

void update(Mapi dbh, char *q)
{
    MapiHdl ret = query(dbh, q);
    if (mapi_close_handle(ret) != MOK)
        die(dbh, ret);
}

void main() {
    dbh = mapi_connect("localhost", 50000, "monetdb", "monetdb", "sql", "dbname");
    if (mapi_error(dbh)) {
        die(dbh, hdl);
    }
   
    for (int i=0; i< 2500; i++) {
        char *p = INSERT_INTO_STATEMENT;
        update(dbh, p);
    }

}


Does anyone see any reason that the MAPI would choke mid way through the For loop?

Any help would be majorly appreciated. I am at a loss.

Cheers,
Brett