On Fri, Sep 26, 2008 at 03:20:29PM +0200, Izzy wrote:
> and tried
> pCon = new mysqlpp::Connection[ 20 ];
> everything linked normally without problems.
> But when I looped and tried to connect every connection, I got bunch
> of catched exceptions, like MySql gonne away, and similar.
> After days of experimenting what may be wrong, I found the solution. I
> need to declare array of pointers, then create every of them
> with default constructor set to true or false.
> like mysqlpp::Connection *pCon[ 20 ];
> for(int i = 0; i< 20; i++)
> pCon[i] = new mysqlpp::Conneciton(false);
Are you sure that the errors are really going away? It just looks like
you're turning off exceptions, and now hiding the potential connection
Some questions that might help track down the problem:
Are you connecting each of those connections manually?
Can you get data from each connection? Is there a time delay that might
cause all those connections to timeout? What does your code do when timeouts
Is this a multi-threaded app?
(btw, this has nothing to do with new/delete... as you mentioned, it should
work either way)