public interface OraclePooledConnectionBuilder
OracleConnectionPoolDataSource
object, used to establish a connection to the database that the OracleConnectionPoolDataSource
object represents. The connection properties that were specified for the OracleConnectionPoolDataSource
are used as the default values by the OraclePooledConnectionBuilder
.
To use the builder, the corresponding builder method needs to be called for each parameter that needs to be part of the connection request followed by a build() method. The order in which the builder methods are called is not important. However if the same builder attribute is applied more than once, only the most recent value will be considered while building the connection. The builder object can be reused to build more than one connection and the builder attributes will be retained across multiple invocations of the build() method.
The following example illustrates the use of OraclePooledConnectionBuilder
to create a OraclePooledConnection
:
OracleConnectionPoolDataSource ods =
new oracle.jdbc.pool.OracleConnectionPoolDataSource();
OracleShardingKey superShardingKey =
ods.createShardingKeyBuilder()
.subkey("EASTERN_REGION", JDBCType.VARCHAR)
.build();
OracleShardingKey shardingKey =
ods.createShardingKeyBuilder()
.subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
.build();
OraclePooledConnection connection = ods.createConnectionBuilder()
.user("rafa")
.password("tennis")
.setShardingKey(shardingKey)
.setSuperShardingKey(superShardingKey)
.build();
Modifier and Type | Method and Description |
---|---|
OraclePooledConnection |
build()
Builds the OraclePooledConnections object.
|
OraclePooledConnectionBuilder |
password(String password) |
OraclePooledConnectionBuilder |
shardingKey(OracleShardingKey shardingKey) |
OraclePooledConnectionBuilder |
superShardingKey(OracleShardingKey superShardingKey) |
OraclePooledConnectionBuilder |
user(String user) |
OraclePooledConnectionBuilder user(String user)
user
-OraclePooledConnectionBuilder
object.OraclePooledConnectionBuilder password(String password)
password
-OraclePooledConnectionBuilder
object.OraclePooledConnectionBuilder shardingKey(OracleShardingKey shardingKey)
shardingKey
- Sharding Key object that needs to be part of connection requestOraclePooledConnectionBuilder
object.OraclePooledConnectionBuilder superShardingKey(OracleShardingKey superShardingKey)
superShardingKey
- Super sharding key object that needs to be part of connection requestOraclePooledConnectionBuilder
object.OraclePooledConnection build() throws SQLException
OraclePooledConnection
that is built.SQLException