simple remote ODBC database connection with ruby

╄→гoц情女王★ 提交于 2019-12-01 06:30:54
sean lynch

I think what you are looking for is Ruby DBI.
http://ruby-dbi.rubyforge.org/

Here is an example of using DBI for ODBC connectivity:

# Require in the DBI files<br />
require 'DBI'

# create an ODBC connection instance<br />
dbi_conn = DBI.connect('DBI:ODBC:datasource','your_username','your_password')

# query tables available  <br />
dbi_conn.tables

# returns an array with the results from a table TABLE:<br />
array_out = dbi_conn.select_all('SELECT * FROM TABLE')

some more in-depth info:
http://www.kitebird.com/articles/ruby-dbi.html

Or, alternatively, you can use ruby-odbc:
http://odbc-rails.rubyforge.org/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!