mirror of https://github.com/apache/druid.git
DbConnector: Optional validation query (default off for now)
This commit is contained in:
parent
cc30dfad2f
commit
1dfe133554
|
@ -125,6 +125,11 @@ public class DbConnector
|
|||
dataSource.setPassword(config.getDatabasePassword());
|
||||
dataSource.setUrl(config.getDatabaseConnectURI());
|
||||
|
||||
if (config.isValidationQuery()) {
|
||||
dataSource.setValidationQuery("SELECT 1");
|
||||
dataSource.setTestOnBorrow(true);
|
||||
}
|
||||
|
||||
return dataSource;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,4 +41,10 @@ public abstract class DbConnectorConfig
|
|||
@JsonProperty("segmentTable")
|
||||
@Config("druid.database.segmentTable")
|
||||
public abstract String getSegmentTable();
|
||||
|
||||
@JsonProperty("validationQuery")
|
||||
@Config("druid.database.validation")
|
||||
public boolean isValidationQuery() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue