XAConnectionBuilder
OracleXAConnectionBuilderImpl
public interface OracleXAConnectionBuilder extends XAConnectionBuilder
OracleXADataSource
object, used to establish a connection to the database that the OracleXADataSource
object represents. The connection properties that were specified for the OracleDataSource
are used as the default values by the OracleXAConnectionBuilder
.
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 a OracleXAConnection
:
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();
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 a
SSLContext 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) |
OracleXAConnectionBuilder user(String user)
user
in interface XAConnectionBuilder
user
-OracleXAConnectionBuilder
objectOracleXAConnectionBuilder password(String password)
password
in interface XAConnectionBuilder
password
-OracleXAConnectionBuilder
objectOracleXAConnectionBuilder shardingKey(OracleShardingKey shardingKey)
shardingKey
- Sharding Key object that needs to be part of connection requestOracleXAConnectionBuilder
objectOracleXAConnectionBuilder superShardingKey(OracleShardingKey superShardingKey)
superShardingKey
- Super sharding key object that needs to be part of connection requestOracleXAConnectionBuilder
objectOracleXAConnectionBuilder shardingKey(ShardingKey shardingKey)
shardingKey
in interface XAConnectionBuilder
shardingKey
- Sharding Key object that needs to be part of connection requestOracleXAConnectionBuilder
objectOracleXAConnectionBuilder superShardingKey(ShardingKey superShardingKey)
superShardingKey
in interface XAConnectionBuilder
superShardingKey
- Super sharding key object that needs to be part of connection requestOracleXAConnectionBuilder
objectOracleXAConnectionBuilder gssCredential(GSSCredential credential)
credential
- used to authenticate the connection. Not null.OracleXAConnectionBuilder 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
objectOracleXAConnection build() throws SQLException
build
in interface XAConnectionBuilder
OracleXAConnection
that is built.SQLException