本記事では CData サポート担当からこんなことを聞かれたらどこを確認すべきか?という観点で、よく頂くお問合せ内容をご紹介します。
記事はこちら →CData ODBC Driver for ADP を使うと、簡単にRuby アプリケーションにリアルタイムADP データを連携・統合できます。 Tこの記事では、ADP] データにリアルタイムに連携するRuby アプリケーションを構築して、クエリを実行し、結果を表示してみます。
通常はCData ODBC Driver のインストール後にODBC DSN 接続ウィザードが立ち上がり、設定を行うことができます。 もしODBC DSN 接続が未済の場合には、Microsoft ODBC データソースアドミニストレータでODBC DSN を作成および設定することができます。
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.
If you do not have Ruby installed, refer to the Ruby インストールページ. Ruby をインストールしたら、次にruby-dbi、dbd-odbc、ruby-odbc gems をインストールします:
gem install dbi
gem install dbd-odbc
gem install ruby-odbc
Ruby ファイル (例: ADPSelect.rb) を作成し、テキストエディタで開きます。ファイルに次のコードをコピーします:
#connect to the DSN
require 'DBI'
cnxn = DBI.connect('DBI:ODBC:CData ADP Source','','')
#execute a SELECT query and store the result set
resultSet = cnxn.execute("SELECT AssociateOID, WorkerID FROM Workers WHERE AssociateOID = 'G3349PZGBADQY8H8'")
#display the names of the columns
resultSet.column_names.each do |name|
print name, "\t"
end
puts
#display the results
while row = resultSet.fetch do
(0..resultSet.column_names.size - 1).each do |n|
print row[n], "\t"
end
puts
end
resultSet.finish
#close the connection
cnxn.disconnect if cnxn
これで、Ruby で ADP データが接続できるようになります。簡単にコマンドラインからファイルを叩いて接続を確認してみましょう。:
ruby ADPSelect.rb
ADP へのSQL-92 企画のSQL を使って、Ruby に簡単にADP を連携できます。是非、トライアルで試してみてください。