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
  • <section role="region"> </section>