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?
I tried adding ?connectTimeout=2000&socketTimeout=2000 to the connection URI, but that didn't make a difference.
This is exactly how it's configured, eg
jdbc:mysql://aaa.bbb.ccc.rds.amazonaws.com:1234/hello?connectTimeout=5000&socketTimeout=30000
See https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html .
Adding this before you call getConnection.
...
DriverManager.setLoginTimeout(2);
DriverManager.getConnection(connectString);
...
Worked in my case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With