APIdia Launch Partner
Top Description Methods
javax.sql

public Interface XAConnectionBuilder

Imports
java.sql.SQLException, .ShardingKey

A builder created from a XADataSource object, used to establish a connection to the database that the data source object represents. The connection properties that were specified for the data source are used as the default values by the XAConnectionBuilder.

The following example illustrates the use of XAConnectionBuilder to create a XAConnection:

XADataSource ds = new MyXADataSource();
    ShardingKey superShardingKey = ds.createShardingKeyBuilder()
                          .subkey("EASTERN_REGION", JDBCType.VARCHAR)
                          .build();
    ShardingKey shardingKey = ds.createShardingKeyBuilder()
                          .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
                          .build();
    XAConnection con = ds.createXAConnectionBuilder()
                      .user("rafa")
                      .password("tennis")
                      .shardingKey(shardingKey)
                      .superShardingKey(superShardingKey)
                      .build();
Since
9

Method Summary

Modifier and TypeMethod and Description
public XAConnection

Returns:

The built object
build
()

Returns an instance of the object defined by this builder.

public XAConnectionBuilder

Returns:

the same XAConnectionBuilder instance
password
(String
the password to use for this connection. May be null
password
)

Specifies the password to be used when creating a connection

public XAConnectionBuilder

Returns:

the same XAConnectionBuilder instance
shardingKey
(ShardingKey
the ShardingKey. May be null
shardingKey
)

Specifies a shardingKey to be used when creating a connection

public XAConnectionBuilder

Returns:

the same XAConnectionBuilder instance
superShardingKey
(ShardingKey
the SuperShardingKey. May be null
superShardingKey
)

Specifies a superShardingKey to be used when creating a connection

public XAConnectionBuilder

Returns:

the same XAConnectionBuilder instance
user
(String
the database user on whose behalf the connection is being made
username
)

Specifies the username to be used when creating a connection

Method Detail

buildback to summary
public XAConnection build() throws SQLException

Returns an instance of the object defined by this builder.

Returns:XAConnection

The built object

Exceptions
SQLException:
If an error occurs building the object
passwordback to summary
public XAConnectionBuilder password(String password)

Specifies the password to be used when creating a connection

Parameters
password:String

the password to use for this connection. May be null

Returns:XAConnectionBuilder

the same XAConnectionBuilder instance

shardingKeyback to summary
public XAConnectionBuilder shardingKey(ShardingKey shardingKey)

Specifies a shardingKey to be used when creating a connection

Parameters
shardingKey:ShardingKey

the ShardingKey. May be null

Returns:XAConnectionBuilder

the same XAConnectionBuilder instance

See Also
java.sql.ShardingKey, java.sql.ShardingKeyBuilder
superShardingKeyback to summary
public XAConnectionBuilder superShardingKey(ShardingKey superShardingKey)

Specifies a superShardingKey to be used when creating a connection

Parameters
superShardingKey:ShardingKey

the SuperShardingKey. May be null

Returns:XAConnectionBuilder

the same XAConnectionBuilder instance

See Also
java.sql.ShardingKey, java.sql.ShardingKeyBuilder
userback to summary
public XAConnectionBuilder user(String username)

Specifies the username to be used when creating a connection

Parameters
username:String

the database user on whose behalf the connection is being made

Returns:XAConnectionBuilder

the same XAConnectionBuilder instance