本記事では CData サポート担当からこんなことを聞かれたらどこを確認すべきか?という観点で、よく頂くお問合せ内容をご紹介します。
記事はこちら →CData JDBC Driver for ADP は、Java Web アプリケーションに簡単に統合して利用することができます。本記事では、Jetty でドライバーをコネクションプールとして設定することで、効率的にADP データをアプリケーションで連携利用する方法を説明します。Jetty でJNDI resource for ADP を設定します。
次の手順で、Jetty とADP の接続を確立します。
Jetty ベースでJNDI モジュールを有効化します。JNDI を有効化するコマンドラインは以下の通り:
java -jar ../start.jar --add-to-startd=jndi
<Configure id='adpdemo' class="org.eclipse.jetty.webapp.WebAppContext">
<New id="adpdemo" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref refid="adpdemo"/></Arg>
<Arg>jdbc/adpdb</Arg>
<Arg>
<New class="cdata.jdbc.adp.ADPDriver">
<Set name="url">jdbc:adp:</Set>
<Set name="OAuthClientId">YourClientId</Set>
<Set name="OAuthClientSecret">YourClientSecret</Set>
<Set name="SSLClientCert">'c:\cert.pfx'</Set>
<Set name="SSLClientCertPassword">'admin@123'</Set>
</New>
</Arg>
</New>
</Configure>
Connect to ADP by specifying the following properties:
The connector uses OAuth to authenticate with ADP. OAuth requires the authenticating user to interact with ADP using the browser. For more information, refer to the OAuth section in the Help documentation.
Web xml でリソースを設定します:
jdbc/adpdb
javax.sql.DataSource
Container
これで、java:comp/env/jdbc/adpdb へのルックアップでADP データにアクセスできます:
InitialContext ctx = new InitialContext();
DataSource myadp = (DataSource)ctx.lookup("java:comp/env/jdbc/adpdb");
ここでは、シンプルなコネクションプーリングシナリオでのドライバーの接続について説明しました。追加での連携ケースについては、Jetty ドキュメントのWorking with Jetty JNDI 参照してください。