public interface UCPXAConnectionBuilder
PoolXADataSource
object, used to get a
connection to the database that the PoolXADataSource
object
represents. The connection properties that were specified for the
PoolXADataSource
are used as the default values by the
UCPXAConnectionBuilder
.
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 UCPXAConnectionBuilder
to get a XAConnection
:
PoolXADataSource pdsXa = new PoolXADataSourceImpl();
OracleShardingKey superShardingKey = pdsXa.createShardingKeyBuilder()
.subkey("EASTERN_REGION", JDBCType.VARCHAR)
.build();
OracleShardingKey shardingKey = pdsXa.createShardingKeyBuilder()
.subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
.build();
OracleConnection connection = pds.createConnectionBuilder()
.user("rafa")
.password("tennis")
.shardingKey(shardingKey)
.superShardingKey(superShardingKey)
.build();
Modifier and Type | Method and Description |
---|---|
javax.sql.XAConnection |
build()
Builds the XA connection object.
|
UCPXAConnectionBuilder |
labels(java.util.Properties labels)
Sets the labels attribute on the builder
|
UCPXAConnectionBuilder |
password(java.lang.String password)
Sets the password attribute on the builder
|
UCPXAConnectionBuilder |
pdbRoles(java.util.Properties pdbRoles)
Sets the PDB roles to be set on the connection from the pool in connection
repurposing case for a multitenant database.
|
UCPXAConnectionBuilder |
proxyProperties(int proxyType,
java.util.Properties proxyProperties)
Sets the proxy properties on the builder that is used to create proxy
session of the particular type as specified by the parameter proxyType
|
UCPXAConnectionBuilder |
serviceName(java.lang.String serviceName)
Sets the service name attribute on the builder
|
UCPXAConnectionBuilder |
shardingKey(oracle.jdbc.OracleShardingKey shardingKey) |
UCPXAConnectionBuilder |
superShardingKey(oracle.jdbc.OracleShardingKey superShardingKey) |
UCPXAConnectionBuilder |
user(java.lang.String user)
Sets the user attribute on the builder
|
UCPXAConnectionBuilder user(java.lang.String user)
user
- the database user on whose behalf the connection is being madeUCPXAConnectionBuilder password(java.lang.String password)
password
- UCPXAConnectionBuilder labels(java.util.Properties labels)
labels
- The requested connection labels.UCPXAConnectionBuilder serviceName(java.lang.String serviceName)
serviceName
- to retrieve the connectionUCPXAConnectionBuilder proxyProperties(int proxyType, java.util.Properties proxyProperties)
proxyType
- create proxy session of this typeproxyProperties
- connection with these proxy propertiesoracle.jdbc.OracleConnection.openProxySession(int type,
java.util.Properties prop)} for valid combinations of the proxy session
properties
UCPXAConnectionBuilder shardingKey(oracle.jdbc.OracleShardingKey shardingKey)
shardingKey
- Sharding Key object that needs to be part of connection requestUCPXAConnectionBuilder superShardingKey(oracle.jdbc.OracleShardingKey superShardingKey)
superShardingKey
- Super shardingKey key object that needs to be part of connection
requestUCPXAConnectionBuilder pdbRoles(java.util.Properties pdbRoles)
pdbRoles
- PDB roles and their passwords passed in as key value pairsjavax.sql.XAConnection build() throws java.sql.SQLException
java.sql.SQLException
- if there is a failure in building the connection.