yluom commented on issue #7780:
URL: 
https://github.com/apache/shardingsphere/issues/7780#issuecomment-1535986313

   If you are stuck with an old version of shardingsphere and have this issue, 
there is a fix to bypass this Connection#isValid() validation and use query 
validation instead: 
   `@Configuration
   public class DataSourceHealthConfig extends 
DataSourceHealthContributorAutoConfiguration {
   
       @Value("${whatever.custom-db-validation-query:select 1}")
       private String defaultQuery;
   
   
       public DataSourceHealthConfig(Map<String, DataSource> dataSources, 
ObjectProvider<DataSourcePoolMetadataProvider> metadataProviders) {
           super(dataSources, metadataProviders);
       }
   
       @Override
       protected AbstractHealthIndicator createIndicator(DataSource source) {
           DataSourceHealthIndicator indicator = (DataSourceHealthIndicator) 
super.createIndicator(source);
           if (!StringUtils.hasText(indicator.getQuery())) {
               indicator.setQuery(defaultQuery);
           }
           return indicator;
       }
   }`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to