我看到JDBC MySQL驱动程序在10秒后始终无法连接尝试停止MySQL,但我想更改该超时。
我尝试将?connectTimeout = 2000&socketTimeout = 2000添加到连接URI,但这没有什么区别。
有没有办法自定义驱动程序在连接MySQL时返回超时所需的时间?
谢谢!
爱德华
I'm seeing the JDBC MySQL driver consistently fail connection attempts to a stopped MySQL after 10 seconds, but I'd like to change that timeout.
I tried adding ?connectTimeout=2000&socketTimeout=2000 to the connection URI, but that didn't make a difference.
Is there a way to customize how long it takes for the Driver to return a timeout while connecting to MySQL?
Thanks!
Eduard
最满意答案
您可以更改MySQL配置文件中的默认值(mysqld部分中的connect-timeout选项) -
[mysqld] connect-timeout=100如果您无法访问此文件,则可以使用此语句设置此值 -
SET GLOBAL connect_timeout=100;You can change the default value in MySQL configuration file (connect-timeout option in mysqld section) -
[mysqld] connect-timeout=100If this file is not accessible for you, then you can set this value using this statement -
SET GLOBAL connect_timeout=100;更多推荐
发布评论