モジュール java.sql
パッケージ javax.sql

インタフェースPooledConnectionBuilder



  • public interface PooledConnectionBuilder
    ConnectionPoolDataSourceオブジェクトから作成されたビルダー。data sourceオブジェクトが表すデータベースへの接続を確立するために使用されます。 data sourceに指定された接続プロパティは、PooledConnectionBuilderによってデフォルト値として使用されます。

    次の例は、PooledConnectionBuilderを使用してXAConnectionを作成する方法を示しています:

    
         ConnectionPoolDataSource ds = new MyConnectionPoolDataSource();
         ShardingKey superShardingKey = ds.createShardingKeyBuilder()
                               .subkey("EASTERN_REGION", JDBCType.VARCHAR)
                               .build();
         ShardingKey shardingKey = ds.createShardingKeyBuilder()
                               .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
                               .build();
         PooledConnection con = ds.createPooledConnectionBuilder()
                           .user("rafa")
                           .password("tennis")
                           .setShardingKey(shardingKey)
                           .setSuperShardingKey(superShardingKey)
                           .build();
     
    導入されたバージョン:
    9
    • メソッドの詳細

      • user

        PooledConnectionBuilder user​(String username)
        接続を作成するときに使用するユーザー名を指定
        パラメータ:
        username - その代理として接続が行われるデータベース・ユーザー
        戻り値:
        同じPooledConnectionBuilderインスタンス
      • password

        PooledConnectionBuilder password​(String password)
        接続を作成するときに使用するパスワードを指定します
        パラメータ:
        password - この接続に使用するパスワード。 nullの可能性がある
        戻り値:
        同じPooledConnectionBuilderインスタンス
      • shardingKey

        PooledConnectionBuilder shardingKey​(ShardingKey shardingKey)
        接続を作成するときに使用するshardingKeyを指定
        パラメータ:
        shardingKey - ShardingKey。 nullの可能性がある
        戻り値:
        同じPooledConnectionBuilderインスタンス
        関連項目:
        ShardingKey, ShardingKeyBuilder
      • superShardingKey

        PooledConnectionBuilder superShardingKey​(ShardingKey superShardingKey)
        接続を作成するときに使用するsuperShardingKeyを指定
        パラメータ:
        superShardingKey - SuperShardingKey。 nullの可能性がある
        戻り値:
        同じPooledConnectionBuilderインスタンス
        関連項目:
        ShardingKey, ShardingKeyBuilder
      • build

        PooledConnection build​()
                        throws SQLException
        このBuilderによって定義されたオブジェクトのインスタンスを返します。
        戻り値:
        構築されたオブジェクト
        例外:
        SQLException - オブジェクトの構築中にエラーが発生した場合