Merge pull request #37501 from sreekarareddy

* pr/37501:
  Don't call setValidateConnectionOnBorrow on Oracle UCP datasource

Closes gh-37501
pull/37626/head
Moritz Halbritter 1 year ago
commit 578b4643ac

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

@ -152,10 +152,10 @@ class DataSourceAutoConfigurationTests {
}
@Test
void oracleUcpValidatesConnectionByDefault() {
void oracleUcpDoesNotValidateConnectionByDefault() {
assertDataSource(PoolDataSourceImpl.class,
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
assertThat(dataSource.getSQLForValidateConnection()).isNull();
});

Loading…
Cancel
Save