IBM Cloud Object Storage をJava サーブレットに統合します。JBoss のManagement Console を使用して、CData JDBC Driver for IBM Cloud Object Storage をインストールします。
CData JDBC ドライバーは、コネクションプールの標準手順に従ってJBoss で構成できます。この記事では、JBoss アプリケーションのコネクションプールからSalesforce データにアクセスする方法について詳しく説明します。また、JBoss Management Interface を使用してCData JDBC Driver for IBM Cloud Object Storage を設定する方法についても詳しく説明します。最後には、コネクションプールからIBM Cloud Object Storage にアクセスできるようになります。
※製品について詳しい情報をご希望の方は以下からお進みください。
- IBM Cloud Object Storage にほかのBI、ETL、開発ツールから接続したい:IBM Cloud Object Storage データ連携ガイドおよびチュートリアルのリストへ
- IBM Cloud Object Storage Drivers について詳細を知りたい:ドライバー詳細情報ページへ
- ほかのデータソースに連携したい:CData Drivers 一覧へ
- ドライバーの30日の無償トライアル版を使いたい:トライアル版ダウンロードページへ
- 製品の利用やライセンスについて相談したい:sales@cdata.co.jp までメールにてご相談ください。
Management Console からJDBC Data Source for IBM Cloud Object Storage を作成
以下のステップに従ってドライバーJAR を追加し、必要な接続プロパティを定義します。
- [Runtime]メニューで、展開先がマネージドドメインかスタンドアロンサーバーかに応じて[Domain]または[Server]メニューを選択し、[Manage deployments]をクリックして[Deployments]ページを開きます。
- [Add]をクリックします。表示されるウィザードで、インストールディレクトリのlib サブフォルダにあるドライバーのJAR ファイルとライセンスを追加します。ウィザードをデフォルトで終了し、ドライバーを選択して[Enable]をクリックします。
- [Configuration]メニューで[Subsystems]->[Connector]->[Datasources]と進みます。これにより、JDBC データソースページが開きます。
- [Add]をクリックし、表示されるウィザードでドライバーとJNDI の名前を入力します。例:
java:jboss/root/jdbc/IBMCloudObjectStorage
- 上で追加したドライバーを選択します。
- JDBC URL、ユーザー名、パスワードを入力します。JDBC URL の構文は、jdbc:ibmcloudobjectstorage: の後にセミコロンで区切られた接続プロパティのリストが続きます。
Register a New Instance of Cloud Object Storage
If you do not already have Cloud Object Storage in your IBM Cloud account, follow the procedure below to install an instance of SQL Query in your account:
- Log in to your IBM Cloud account.
- Navigate to the page, choose a name for your instance and click Create. You will be redirected to the instance of Cloud Object Storage you just created.
Connecting using OAuth Authentication
There are certain connection properties you need to set before you can connect. You can obtain these as follows:
API Key
To connect with IBM Cloud Object Storage, you need an API Key. You can obtain this as follows:
- Log in to your IBM Cloud account.
- Navigate to the Platform API Keys page.
- On the middle-right corner click "Create an IBM Cloud API Key" to create a new API Key.
- In the pop-up window, specify the API Key name and click "Create". Note the API Key as you can never access it again from the dashboard.
Cloud Object Storage CRN
If you have multiple accounts, you will need to specify the CloudObjectStorageCRN explicitly. To find the appropriate value, you can:
- Query the Services view. This will list your IBM Cloud Object Storage instances along with the CRN for each.
- Locate the CRN directly in IBM Cloud. To do so, navigate to your IBM Cloud Dashboard. In the Resource List, Under Storage, select your Cloud Object Storage resource to get its CRN.
Connecting to Data
You can now set the following to connect to data:
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- ApiKey: Set this to your API key which was noted during setup.
- CloudObjectStorageCRN (Optional): Set this to the cloud object storage CRN you want to work with. While the connector attempts to retrieve this automatically, specifying this explicitly is recommended if you have more than Cloud Object Storage account.
When you connect, the connector completes the OAuth process.
- Extracts the access token and authenticates requests.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
以下は一般的な接続文字列です。
jdbc:ibmcloudobjectstorage:ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret;
接続を確認したらウィザードを終了します。IBM Cloud Object Storage のデータソースを選択し、[Enable]をクリックします。

その他のJBoss 統合
上記のステップは、単純なコネクションプールのシナリオでドライバーを構成する方法を示しています。より詳しい情報については、JBoss EAP ドキュメントの[Data Source Management]の章を参照してください。