Interface OraclePooledConnectionBuilder
-
- All Superinterfaces:
PooledConnectionBuilder
public interface OraclePooledConnectionBuilder extends PooledConnectionBuilder
A builder created from aOracleConnectionPoolDataSource
object, used to establish a connection to the database that theOracleConnectionPoolDataSource
object represents. The connection properties that were specified for theOracleConnectionPoolDataSource
are used as the default values by theOraclePooledConnectionBuilder
.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 aOraclePooledConnection
: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();
- Since:
- 12.2
-
-
Method Summary
-
-
-
Method Detail
-
user
OraclePooledConnectionBuilder user(String user)
- Specified by:
user
in interfacePooledConnectionBuilder
- Parameters:
user
-- Returns:
- This
OraclePooledConnectionBuilder
object.
-
password
OraclePooledConnectionBuilder password(String password)
- Specified by:
password
in interfacePooledConnectionBuilder
- Parameters:
password
-- Returns:
- This
OraclePooledConnectionBuilder
object.
-
shardingKey
OraclePooledConnectionBuilder shardingKey(OracleShardingKey shardingKey)
- Parameters:
shardingKey
- Sharding Key object that needs to be part of connection request- Returns:
- This
OraclePooledConnectionBuilder
object.
-
superShardingKey
OraclePooledConnectionBuilder superShardingKey(OracleShardingKey superShardingKey)
- Parameters:
superShardingKey
- Super sharding key object that needs to be part of connection request- Returns:
- This
OraclePooledConnectionBuilder
object.
-
shardingKey
OraclePooledConnectionBuilder shardingKey(ShardingKey shardingKey)
- Specified by:
shardingKey
in interfacePooledConnectionBuilder
- Parameters:
shardingKey
- Sharding Key object that needs to be part of connection request- Returns:
- This
OraclePooledConnectionBuilder
object.
-
superShardingKey
OraclePooledConnectionBuilder superShardingKey(ShardingKey superShardingKey)
- Specified by:
superShardingKey
in interfacePooledConnectionBuilder
- Parameters:
superShardingKey
- Super sharding key object that needs to be part of connection request- Returns:
- This
OraclePooledConnectionBuilder
object.
-
gssCredential
OraclePooledConnectionBuilder gssCredential(GSSCredential credential)
Provide the GSSCredential used to authenticate the connection.- Parameters:
credential
- used to authenticate the connection. Not null.
-
sslContext
OraclePooledConnectionBuilder sslContext(SSLContext sslContext)
Specifies aSSLContext
to use as a factory for SSLEngine objects that carry out the TLS protocol.The SSLContext must be initialized before building the connection. The certificates specified by that initialization will be used in place of any connection properties that would otherwise have specified certificates, such as key store and trust store property values.
Specifying a null value will clear any non-null value that may have been set previously, causing this builder to behave as if this method had never been called at all.
- Parameters:
sslContext
- An SSLContext to use as an SSLEngine factory.- Returns:
- This
OraclePooledConnectionBuilder
object
-
readOnlyInstanceAllowed
OraclePooledConnectionBuilder readOnlyInstanceAllowed(boolean readOnlyInstanceAllowed)
Sets the read-only instance allowed value on this builder. This property is applicable to sharded database only. When the property value is set to true, the database allows connection creation to read-only instances as well otherwise not. A shard instance goes into read-only mode for a chunk if the chunk move/split operation is in progress on that instance. The default value is false which means by default connection creation is not allowed to a read-only instance.- Parameters:
readOnlyInstanceAllowed
- whether to allow connection creation to a read-only instance or not- Returns:
- This
OraclePooledConnectionBuilder
object
-
build
OraclePooledConnection build() throws SQLException
Builds the OraclePooledConnections object.- Specified by:
build
in interfacePooledConnectionBuilder
- Returns:
- New
OraclePooledConnection
that is built. - Throws:
SQLException
-
-