PooledConnectionBuilder
OraclePooledConnectionBuilderImpl
public interface OraclePooledConnectionBuilder extends PooledConnectionBuilder
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 | Description |
---|---|---|
OraclePooledConnection |
build() |
Builds the OraclePooledConnections object.
|
OraclePooledConnectionBuilder |
gssCredential(GSSCredential credential) |
Provide the GSSCredential used to authenticate the connection.
|
OraclePooledConnectionBuilder |
password(String password) |
|
OraclePooledConnectionBuilder |
shardingKey(ShardingKey shardingKey) |
|
OraclePooledConnectionBuilder |
shardingKey(OracleShardingKey shardingKey) |
|
OraclePooledConnectionBuilder |
sslContext(SSLContext sslContext) |
Specifies a
SSLContext to use as a factory for SSLEngine objects that carry out the TLS protocol. |
OraclePooledConnectionBuilder |
superShardingKey(ShardingKey superShardingKey) |
|
OraclePooledConnectionBuilder |
superShardingKey(OracleShardingKey superShardingKey) |
|
OraclePooledConnectionBuilder |
user(String user) |
OraclePooledConnectionBuilder user(String user)
user
in interface PooledConnectionBuilder
user
-OraclePooledConnectionBuilder
object.OraclePooledConnectionBuilder password(String password)
password
in interface PooledConnectionBuilder
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.OraclePooledConnectionBuilder shardingKey(ShardingKey shardingKey)
shardingKey
in interface PooledConnectionBuilder
shardingKey
- Sharding Key object that needs to be part of connection requestOraclePooledConnectionBuilder
object.OraclePooledConnectionBuilder superShardingKey(ShardingKey superShardingKey)
superShardingKey
in interface PooledConnectionBuilder
superShardingKey
- Super sharding key object that needs to be part of connection requestOraclePooledConnectionBuilder
object.OraclePooledConnectionBuilder gssCredential(GSSCredential credential)
credential
- used to authenticate the connection. Not null.OraclePooledConnectionBuilder sslContext(SSLContext sslContext)
SSLContext
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.
sslContext
- An SSLContext to use as an SSLEngine factory.OraclePooledConnectionBuilder
objectOraclePooledConnection build() throws SQLException
build
in interface PooledConnectionBuilder
OraclePooledConnection
that is built.SQLException