ConnectionBuilderOracleConnectionBuilderImplpublic interface OracleConnectionBuilder extends ConnectionBuilder
OracleDataSource object, used to establish a
connection to the database that the OracleDataSource object
represents. The connection properties that were specified for the
OracleDataSource are used as the default values by the
OracleConnectionBuilder.
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 OracleConnectionBuilder
to create a OracleConnection:
OracleDataSource ods = new oracle.jdbc.pool.OracleDataSource();
OracleShardingKey superShardingKey =
ods.createShardingKeyBuilder()
.subkey("EASTERN_REGION", JDBCType.VARCHAR)
.build();
OracleShardingKey shardingKey =
ods.createShardingKeyBuilder()
.subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
.build();
OracleConnection connection = ods.createConnectionBuilder()
.user("rafa")
.password("tennis")
.shardingKey(shardingKey)
.superShardingKey(superShardingKey)
.build();
| Modifier and Type | Method | Description |
|---|---|---|
OracleConnection |
build() |
Builds the connection object.
|
OracleConnectionBuilder |
gssCredential(GSSCredential credential) |
Provide the GSSCredential used to authenticate the connection.
|
OracleConnectionBuilder |
password(String password) |
|
OracleConnectionBuilder |
shardingKey(ShardingKey shardingKey) |
|
OracleConnectionBuilder |
shardingKey(OracleShardingKey shardingKey) |
|
OracleConnectionBuilder |
superShardingKey(ShardingKey superShardingKey) |
|
OracleConnectionBuilder |
superShardingKey(OracleShardingKey superShardingKey) |
|
OracleConnectionBuilder |
user(String user) |
OracleConnectionBuilder user(String user)
user in interface ConnectionBuilderuser - OracleConnectionBuilder objectOracleConnectionBuilder password(String password)
password in interface ConnectionBuilderpassword - OracleConnectionBuilder objectOracleConnectionBuilder shardingKey(OracleShardingKey shardingKey)
shardingKey - Sharding Key object that needs to be part of connection requestOracleConnectionBuilder objectOracleConnectionBuilder superShardingKey(OracleShardingKey superShardingKey)
superShardingKey - Super sharding key object that needs to be part of connection
requestOracleConnectionBuilder objectOracleConnectionBuilder shardingKey(ShardingKey shardingKey)
shardingKey in interface ConnectionBuildershardingKey - Sharding Key object that needs to be part of connection requestOracleConnectionBuilder objectOracleConnectionBuilder superShardingKey(ShardingKey superShardingKey)
superShardingKey in interface ConnectionBuildersuperShardingKey - Super sharding key object that needs to be part of connection
requestOracleConnectionBuilder objectOracleConnectionBuilder gssCredential(GSSCredential credential)
credential - used to authenticate the connection. Not null.OracleConnection build() throws SQLException
build in interface ConnectionBuilderOracleConnection that is created.SQLException
Copyright © 2008, 2017, Oracle. All rights reserved.