JAVA-7334: Update 'Oracle Connection Pooling With Spring' article
This commit is contained in:
+2
-1
@@ -20,7 +20,8 @@ public class OracleConfiguration {
|
||||
dataSource.setUser("books");
|
||||
dataSource.setPassword("books");
|
||||
dataSource.setURL("jdbc:oracle:thin:@//localhost:11521/ORCLPDB1");
|
||||
dataSource.setFastConnectionFailoverEnabled(true);
|
||||
// Only with clients prior to v21
|
||||
// dataSource.setFastConnectionFailoverEnabled(true);
|
||||
dataSource.setImplicitCachingEnabled(true);
|
||||
// Only with clients prior to v11.2
|
||||
// dataSource.setConnectionCachingEnabled(true);
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.baeldung.spring.oracle.pooling.configuration;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
import oracle.ucp.jdbc.PoolDataSource;
|
||||
import oracle.ucp.jdbc.PoolDataSourceFactory;
|
||||
|
||||
@Configuration
|
||||
@Profile("oracle-ucp")
|
||||
public class OracleUCPConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() throws SQLException {
|
||||
PoolDataSource dataSource = PoolDataSourceFactory.getPoolDataSource();
|
||||
dataSource.setUser("books");
|
||||
dataSource.setPassword("books");
|
||||
dataSource.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
|
||||
dataSource.setURL("jdbc:oracle:thin:@//localhost:11521/ORCLPDB1");
|
||||
|
||||
dataSource.setFastConnectionFailoverEnabled(true);
|
||||
dataSource.setInitialPoolSize(5);
|
||||
dataSource.setMinPoolSize(5);
|
||||
dataSource.setMaxPoolSize(10);
|
||||
return dataSource;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user