Don't call setValidateConnectionOnBorrow on Oracle UCP datasource

See gh-37501
pull/37626/head
Sreekara Reddy 1 year ago committed by Moritz Halbritter
parent 40d4c177cd
commit 8fad59466c

@ -180,7 +180,6 @@ abstract class DataSourceConfiguration {
throws SQLException { throws SQLException {
PoolDataSourceImpl dataSource = createDataSource(connectionDetails, PoolDataSourceImpl.class, PoolDataSourceImpl dataSource = createDataSource(connectionDetails, PoolDataSourceImpl.class,
properties.getClassLoader()); properties.getClassLoader());
dataSource.setValidateConnectionOnBorrow(true);
if (StringUtils.hasText(properties.getName())) { if (StringUtils.hasText(properties.getName())) {
dataSource.setConnectionPoolName(properties.getName()); dataSource.setConnectionPoolName(properties.getName());
} }

@ -152,10 +152,10 @@ class DataSourceAutoConfigurationTests {
} }
@Test @Test
void oracleUcpValidatesConnectionByDefault() { void oracleUcpDoesNotValidateConnectionByDefault() {
assertDataSource(PoolDataSourceImpl.class, assertDataSource(PoolDataSourceImpl.class,
Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat", "org.apache.commons.dbcp2"), (dataSource) -> { Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat", "org.apache.commons.dbcp2"), (dataSource) -> {
assertThat(dataSource.getValidateConnectionOnBorrow()).isTrue(); assertThat(dataSource.getValidateConnectionOnBorrow()).isFalse();
// Use an internal ping when using an Oracle JDBC driver // Use an internal ping when using an Oracle JDBC driver
assertThat(dataSource.getSQLForValidateConnection()).isNull(); assertThat(dataSource.getSQLForValidateConnection()).isNull();
}); });

Loading…
Cancel
Save