Hi,
I use mysql ndb7.x, I try to write one simple java programe to detect when ndb can't be connected, but I found DriverManager.getConnection will not return but it will timeout after 20 minutes, so my programe can't tell me if connection can be setup or not until 20 minutes later. so I want to know how to control the DriverManager.getConnection timeout period, e.g. like 20 seconds. Or if there is a better way to detect Mysql ndb(cluster) can't be access through sqlnode. Thanks
my simple code is as below, your comments are highly appreciated,
Properties prop = new Properties();
prop.setProperty("connectTimeout", "5000");
prop.setProperty("socketTimeout", "5000");
return DriverManager.getConnection(
"jdbc:mysql:loadbalance://sc-1:3307,sc-2:3307/table?"
+ "localSocketAddress=xxxx", prop);
I use mysql ndb7.x, I try to write one simple java programe to detect when ndb can't be connected, but I found DriverManager.getConnection will not return but it will timeout after 20 minutes, so my programe can't tell me if connection can be setup or not until 20 minutes later. so I want to know how to control the DriverManager.getConnection timeout period, e.g. like 20 seconds. Or if there is a better way to detect Mysql ndb(cluster) can't be access through sqlnode. Thanks
my simple code is as below, your comments are highly appreciated,
Properties prop = new Properties();
prop.setProperty("connectTimeout", "5000");
prop.setProperty("socketTimeout", "5000");
return DriverManager.getConnection(
"jdbc:mysql:loadbalance://sc-1:3307,sc-2:3307/table?"
+ "localSocketAddress=xxxx", prop);