Interface OracleXAConnectionBuilder
-
- All Superinterfaces:
XAConnectionBuilder
- All Known Implementing Classes:
OracleXAConnectionBuilderImpl
public interface OracleXAConnectionBuilder extends XAConnectionBuilder
A builder created from aOracleXADataSource
object, used to establish a connection to the database that theOracleXADataSource
object represents. The connection properties that were specified for theOracleDataSource
are used as the default values by theOracleXAConnectionBuilder
.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
OracleXAConnectionBuilder
to create aOracleXAConnection
:OracleXADataSource odsXa = new oracle.jdbc.xa.client.OracleXADataSource(); OracleShardingKey superShardingKey = odsXa.createShardingKeyBuilder() .subkey("EASTERN_REGION", JDBCType.VARCHAR) .build(); OracleShardingKey shardingKey = odsXa.createShardingKeyBuilder() .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR) .build(); OracleConnection connection = odsXa.createConnectionBuilder() .user("rafa") .password("tennis") .shardingKey(shardingKey) .superShardingKey(superShardingKey) .build();
- Since:
- 12.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OracleXAConnection
build()
Builds a new XAconnectionConnection object.OracleXAConnectionBuilder
gssCredential(GSSCredential credential)
Provide the GSSCredential used to authenticate the connection.OracleXAConnectionBuilder
password(String password)
OracleXAConnectionBuilder
readOnlyInstanceAllowed(boolean readOnlyInstanceAllowed)
Sets the read-only instance allowed value on this builder.OracleXAConnectionBuilder
shardingKey(ShardingKey shardingKey)
OracleXAConnectionBuilder
shardingKey(OracleShardingKey shardingKey)
OracleXAConnectionBuilder
sslContext(SSLContext sslContext)
Specifies aSSLContext
to use as a factory for SSLEngine objects that carry out the TLS protocol.OracleXAConnectionBuilder
superShardingKey(ShardingKey superShardingKey)
OracleXAConnectionBuilder
superShardingKey(OracleShardingKey superShardingKey)
OracleXAConnectionBuilder
user(String user)
-
-
-
Method Detail
-
user
OracleXAConnectionBuilder user(String user)
- Specified by:
user
in interfaceXAConnectionBuilder
- Parameters:
user
-- Returns:
- This
OracleXAConnectionBuilder
object
-
password
OracleXAConnectionBuilder password(String password)
- Specified by:
password
in interfaceXAConnectionBuilder
- Parameters:
password
-- Returns:
- This
OracleXAConnectionBuilder
object
-
shardingKey
OracleXAConnectionBuilder shardingKey(OracleShardingKey shardingKey)
- Parameters:
shardingKey
- Sharding Key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilder
object
-
superShardingKey
OracleXAConnectionBuilder superShardingKey(OracleShardingKey superShardingKey)
- Parameters:
superShardingKey
- Super sharding key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilder
object
-
shardingKey
OracleXAConnectionBuilder shardingKey(ShardingKey shardingKey)
- Specified by:
shardingKey
in interfaceXAConnectionBuilder
- Parameters:
shardingKey
- Sharding Key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilder
object
-
superShardingKey
OracleXAConnectionBuilder superShardingKey(ShardingKey superShardingKey)
- Specified by:
superShardingKey
in interfaceXAConnectionBuilder
- Parameters:
superShardingKey
- Super sharding key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilder
object
-
gssCredential
OracleXAConnectionBuilder gssCredential(GSSCredential credential)
Provide the GSSCredential used to authenticate the connection.- Parameters:
credential
- used to authenticate the connection. Not null.
-
sslContext
OracleXAConnectionBuilder 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
OracleXAConnectionBuilder
object
-
readOnlyInstanceAllowed
OracleXAConnectionBuilder 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
OracleXAConnectionBuilder
object
-
build
OracleXAConnection build() throws SQLException
Builds a new XAconnectionConnection object.- Specified by:
build
in interfaceXAConnectionBuilder
- Returns:
- New
OracleXAConnection
that is built. - Throws:
SQLException
-
-