JDBC Driver for Cloudant

Build 23.0.8839

接続の確立

JDBC データソースの作成

Java アプリケーションから接続するJDBC データソースを作成できます。CData JDBC Driver for Cloudant に基づくJDBC データソースの作成は、3つの基本ステップで構成されます。

  • ドライバーのJAR ファイルをクラスパスに追加します。JAR ファイルはインストールディレクトリの[lib]サブフォルダ内にあります。.lic ファイルはJAR ファイルと同じフォルダ内に配置される必要があることに注意してください。
  • ドライバークラスを入力します。次に例を示します。
    cdata.jdbc.cloudant.CloudantDriver
  • JDBC URL を入力します。次に例を示します。
    jdbc:cloudant:User=abc123; Password=abcdef;
    
    or
    
    jdbc:cdata:cloudant:User=abc123; Password=abcdef;

    上記の2つ目の形式は、同じURL 形式を使用しているドライバー間でアプリケーションに競合がある場合は、CData ドライバーを使用していることを確認するために常に使用できます。URL は "jdbc:cloudant:" または"jdbc:cdata:cloudant:" のいずれかから始まり、任意の接続プロパティの名前と値のペアをセミコロン区切りで入力します。

Cloudant への認証

Cloudant は3種類の認証をサポートします。

  • Auto(デフォルト):本製品 は、設定された他の接続プロパティに基づいて認証方法を決定します。
  • Basic:基本的なユーザー名 / パスワード認証。AuthSchemeBasic に設定します。
  • OAuth:OAuth 規格に基づいた認証を行います。AuthSchemeOAuth に設定し、Cloudant インスタンスの APIKeyURL の値を指定します。

IBM Cloudant Legacy

IBM Cloudant Legacy 経由で接続するには、有効なIBM Cloudant サービスクレデンシャルを持っていることを確認してください。

IBM Cloudant のサービスクレデンシャルを作成するには:

  1. IBM Cloud ダッシュボードにログインします。
  2. Menu icon -> Resource List に移動し、IBM Cloudant サービスインスタンスを開きます。
  3. メニューで、Service credentials をクリックします。
  4. New credential をクリックします。Cloudant はAdd new credential ウィンドウを表示します。
  5. 新しい資格情報の名前を入力します。
  6. Add をクリックします。 資格情報がService credentials テーブルに追加されます。
  7. Actions -> View credentials をクリックします。
  8. JSON ファイルからUser およびPassword の値を取得します。

取得した値を使用して、User およびPassword を設定します。

IBM Cloud IAM

IBM Cloud IAM is OAuth-based authentication accessed via a web browser.

To authenticate to IBM Cloud, set AuthScheme to OAuth and supply the ApiKey and the Url of the target Cloudant instance (for example, https://0c9d3837-8304-4aab-a65a-648169970943-bluemix.cloudant.com).

After setting InitiateOAuth to GETANDREFRESH (default), you are ready to connect.

When you connect, the 本製品 completes the OAuth process.

  1. Extracts the access token and authenticates requests.
  2. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.

Retrieving OAuth connection properties

To retrieve the OAuth connection properties:

  1. Create an account in IBM Cloud.
  2. Obtain the ApiKey:
    1. Log in to your IBM Cloud account.
    2. Navigate to Platform API Keys page.
    3. To create a new API Key, click Create an IBM Cloud API Key. Cloudant displays a pop-up form.
    4. Specify the API Key name and click Create. Cloudant displays the ApiKey you just created.
      Save this information for future reference.

Registering a new instance of Cloudant

If you do not already have Cloud Object Storage in your IBM Cloud account, you can install an instance of SQL Query in your account:

  1. Log in to your IBM Cloud account.
  2. Navigate to the Cloudant page.
  3. Choose a name for your instance and click Create. You are redirected to that Cloudant instance.

ローカルインスタンスへの認証

Cloudant は、バージョン1.1.0以上のローカルインスタンスのデータへの認証をサポートします。

ローカルインスタンスへの認証を行うには、次のパラメータを設定します。

  1. Url:ローカルインスタンスのURL。例: http://localhost:8006
  2. User:ユーザーネーム。
  3. Password:パスワード。

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839