Reputation: 113
I use libmariadb.dll (native MariaDB connector/c) to connect to my MariaDB database.
I would like to update the default timeout when I try to connect to a MariaDB server and that this server is not available.
What function calls should I apply in the application code to make this timeout have an effect and how do I detect when a timeout has occurred.
Upvotes: 0
Views: 75
Reputation: 14691
Using the MYSQL_OPT_CONNECT_TIMEOUT
as the option for the connection:
unsigned int timeout= 5;
mysql_optionsv(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (void *)&timeout);
ref: Documentation Manual
Upvotes: 0