Although several years later I just wanted to add my 2 pence worth.

I had similar problems to Chad.

It would appear that mysql_options does not work.
The scenario is.
I have a host to which I am trying to connect but that host is down.
(If the host is up but mysqld is not running then mysql_real_connect() does
return)
If the host is down then mysql_real_connect() acn take up to 10 minutes to
timeout si

I tried setting the timeout MYSQL_OPT_CONNECT_TIMEOUT to 3 seconds using
mysql_options. Also the prototype is a little confusing as it says it takes
a char*, but when u look at the argument type for MYSQL_OPT_CONNECT_TIMEOUT
it is unsigned int *. In any case I tried several different calls to
mysql_options and none of them caused the mysql_real_connect() to timeout.

So I decided to try the alternative route of setting the connect-timeout
option in my.cnf and calling mysql_options using the MYSQL_READ_DEFAULT_FILE
option, specifying the path my.cnf and by default it should read the client
group. This caused the call to mysql_real_connect to crash.

I then decided to read this message board.

Sinisa suggested setting the mysql structure directly, much more straight
forward.
This works just fine i.e.
mysql->options.connect_timeout=3;

Regards,

Brian

Brian J Walsh.
Software engineer,
Tel: 408-432-2749
Fax: 408-428-3827

SS8 Networks, Inc.
91 East Tasman Drive
San Jose, CA95134
[EMAIL PROTECTED]
www.SS8.com

Notice to Recipient:  This e-mail is confidential and meant only for the
intended recipient[s] of the transmission and may be a communication
privileged by law.  If you received this e-mail in error, any review, use,
dissemination, distribution or copying of this e-mail is strictly
prohibited.  If you are not the intended recipient, please contact the
sender by reply e-mail and please delete this e-mail from your system and
destroy any copies.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to