Package oracle.jdbc

Interface OracleXAConnectionBuilder

  • All Superinterfaces:
    XAConnectionBuilder
    All Known Implementing Classes:
    OracleXAConnectionBuilderImpl

    public interface OracleXAConnectionBuilder
    extends XAConnectionBuilder
    A builder created from a 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();
      
      

    Since:
    12.2
    • Method Detail

      • 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
      • 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 a 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.

        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