Tomcat Connection Pool からBusiness b-ridge に連携接続。
CData JDBC Drivers は標準JDBC インターフェースをサポートし、JVM 上で実行されるWeb アプリケーションに統合します。この記事では、Tomcat のConnection Pool からBusiness b-ridge に接続する方法について詳しく説明します。
Tomcat のConnection Pool 経由でBusiness b-ridge データに接続
- CData JAR およびCData .lic ファイルを$CATALINA_HOME/lib にコピーします。CData JAR はインストールディレクトリの[lib]サブフォルダ内にあります。
- コンテキストにリソースの定義を追加します:
When connecting to Business b-ridge, CompanyKey, ProjectKey, and SubscriptionKey are required.
To obtain the SubscriptionKey, follow the steps below:
- Log in to Business b-ridge API Protal and go to "Profile" in the "Your name" menu.
- In your subscription section click "Main Key" to retrieve their respective values.
Authenticate to Business b-ridge Account
Set the following connection properties to connect:
- CompanyKey: Set the Business b-ridge Company Key of the connection destination.
- ProjectKey: Set the Business b-ridge Project Key of the connection destination.
- SubscriptionKey: Set the value "Subscription Key".
<Resource name="jdbc/businessbridge" auth="Container" type="javax.sql.DataSource" driverClassName="cdata.jdbc.businessbridge.BusinessBridgeDriver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" url="jdbc:businessbridge:" maxActive="20" maxIdle="10" maxWait="-1" />
一つのアプリケーションからBusiness b-ridge へのアクセスを許可するには、上のコードをアプリケーションのMETA-INF ディレクトリにあるcontext.xml に追加します。
共有リソースの設定には、上のコードを$CATALINA_BASE/conf 内にあるcontext.xml に追加します。共有リソースの設定は、すべてのアプリケーションにSalesforce への接続を提供します。
- アプリケーションのweb.xml にリソースへの参照を追加します。
Business b-ridge data JSP jdbc/BusinessBridge javax.sql.DataSource コンテナ -
Connection pool からの接続の初期化:
Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/BusinessBridge"); Connection conn = ds.getConnection();
そのほかのTomcat へのデータ連携ドライバーの統合
上記の手順では、簡単なコネクションプーリングのシナリオでBusiness b-ridge に接続する方法を説明しました。ほかの使用例や情報については、 Tomcat 製品ドキュメントの 「JNDI Datasource How-To」をご覧ください。