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
-
<section role="region">
-
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
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)
-
-
<section role="region">
-
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
-
build
OracleXAConnection build() throws SQLException
Builds a new XAconnectionConnection object.- Specified by:
build
in interfaceXAConnectionBuilder
- Returns:
- New
OracleXAConnection
that is built. - Throws:
SQLException
-
-