Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SampleJRuby.rb
require 'java'
require 'rubygems'
# CData Salesforce JDBC Driver のjarファイルパスを指定
require "C:/Program Files/CData/CData JDBC Driver for Salesforce 2019J/lib/cdata.jdbc.salesforce.jar"
# Salesforce への接続文字列を設定
url = "jdbc:salesforce:User=XXXX;Password=XXXX;Security Token=XXXX;"
conn = java.sql.DriverManager.getConnection(url)
stmt = conn.createStatement
# SQLを実行・取引先(Account)を取得
rs = stmt.executeQuery("SELECT Id,Name FROM Account")
while (rs.next) do
puts rs.getString(1) + ' ' + rs.getString(2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment