Package oracle.jdbc
Interface OracleShardingKey
-
- All Superinterfaces:
java.lang.Comparable<OracleShardingKey>,java.sql.ShardingKey
- All Known Implementing Classes:
OracleShardingKeyImpl
public interface OracleShardingKey extends java.lang.Comparable<OracleShardingKey>, java.sql.ShardingKey
Interface used to indicate that this object represents an Oracle Sharding Key. AOracleShardingKeyinstance is only guaranteed to be compatible with the oracle data source instance that it was derived from. AOracleShardingKeyis created usingOracleShardingKeyBuilder.The following example illustrates the use of
OracleShardingKeyBuilderto create aOracleShardingKey:OracleDataSource ods = new oracle.jdbc.pool.OracleDataSource(); OracleShardingKey shardingKey = ods.createShardingKeyBuilder() .subkey("Customer_Name_XYZ", JDBCType.VARCHAR) .subkey(94002, JDBCType.NUMERIC) .build();A
OracleShardingKeymay also be used for specifying asuperShardingKey. Databases that support composite Sharding may use asuperShardingKeyto specify an additional level of partitioning within the Shard.The following example illustrates the use of
OracleShardingKeyBuilderto create asuperShardingKeyfor an eastern region with aOracleShardingKeyspecified for the Pittsburgh branch office:OracleDataSource ods = new oracle.pool.OracleDataSource(); OracleShardingKey superShardingKey = ods.createShardingKeyBuilder() .subkey("EASTERN_REGION", JDBCType.VARCHAR) .build(); OracleShardingKey shardingKey = ods.createShardingKeyBuilder() .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR) .build(); OracleConnection conn = ods.createConnectionBuilder() .superShardingKey(superShardingKey) .shardingKey(shardingKey) .build();- Since:
- 12.2