Interface OracleXAConnectionBuilder
-
- All Superinterfaces:
XAConnectionBuilder
- All Known Implementing Classes:
OracleXAConnectionBuilderImpl
public interface OracleXAConnectionBuilder extends XAConnectionBuilder
A builder created from aOracleXADataSourceobject, used to establish a connection to the database that theOracleXADataSourceobject represents. The connection properties that were specified for theOracleDataSourceare 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
OracleXAConnectionBuilderto 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 OracleXAConnectionbuild()Builds a new XAconnectionConnection object.OracleXAConnectionBuildergssCredential(GSSCredential credential)Provide the GSSCredential used to authenticate the connection.OracleXAConnectionBuilderpassword(String password)OracleXAConnectionBuilderreadOnlyInstanceAllowed(boolean readOnlyInstanceAllowed)Sets the read-only instance allowed value on this builder.OracleXAConnectionBuildershardingKey(ShardingKey shardingKey)OracleXAConnectionBuildershardingKey(OracleShardingKey shardingKey)OracleXAConnectionBuildersslContext(SSLContext sslContext)Specifies aSSLContextto use as a factory for SSLEngine objects that carry out the TLS protocol.OracleXAConnectionBuildersuperShardingKey(ShardingKey superShardingKey)OracleXAConnectionBuildersuperShardingKey(OracleShardingKey superShardingKey)OracleXAConnectionBuilderuser(String user)
-
-
-
Method Detail
-
user
OracleXAConnectionBuilder user(String user)
- Specified by:
userin interfaceXAConnectionBuilder- Parameters:
user-- Returns:
- This
OracleXAConnectionBuilderobject
-
password
OracleXAConnectionBuilder password(String password)
- Specified by:
passwordin interfaceXAConnectionBuilder- Parameters:
password-- Returns:
- This
OracleXAConnectionBuilderobject
-
shardingKey
OracleXAConnectionBuilder shardingKey(OracleShardingKey shardingKey)
- Parameters:
shardingKey- Sharding Key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilderobject
-
superShardingKey
OracleXAConnectionBuilder superShardingKey(OracleShardingKey superShardingKey)
- Parameters:
superShardingKey- Super sharding key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilderobject
-
shardingKey
OracleXAConnectionBuilder shardingKey(ShardingKey shardingKey)
- Specified by:
shardingKeyin interfaceXAConnectionBuilder- Parameters:
shardingKey- Sharding Key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilderobject
-
superShardingKey
OracleXAConnectionBuilder superShardingKey(ShardingKey superShardingKey)
- Specified by:
superShardingKeyin interfaceXAConnectionBuilder- Parameters:
superShardingKey- Super sharding key object that needs to be part of connection request- Returns:
- This
OracleXAConnectionBuilderobject
-
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 aSSLContextto 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
OracleXAConnectionBuilderobject
-
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
OracleXAConnectionBuilderobject
-
build
OracleXAConnection build() throws SQLException
Builds a new XAconnectionConnection object.- Specified by:
buildin interfaceXAConnectionBuilder- Returns:
- New
OracleXAConnectionthat is built. - Throws:
SQLException
-
-