On 9/28/2010 11:26 AM, Tom Lachecki wrote:
>
> I'm reading section 3.15 in the tutorial and I'm a little confused.
Yeah, well, you're not the only one. I wrote it, and I was clearly also
a little confused.
> The prose suggests that "ConnectTimeoutOption" is an option to control
> the idle time-out of the connection to the mysql server. However the
> name implies that it is an option to control the timeout of a call to
> connect().
It's the latter. ConnectTimeoutOption solves your problem.
For the interested, I've replaced the recommendation with this:
"Another way around this, on a per-connection basis from the client
side, would be to set the ReconnectOption connection option. This will
cause MySQL++ to reconnect to the server automatically if it drops the
connection. Beware that unless you’re using MySQL 5.1.6 or higher, you
have to set this only after the connection is established, or it won’t
take effect. This means there’s a potential race condition: it’s
possible the connection could drop shortly enough after being
established that you don’t have time to apply the option, so it won’t
come back up automatically. MySQL 5.1.6+ fixes this by allowing this
option to be set before the connection is established."