Ruby connnection string for sql server 2005

Hi All,

I am trying to fetch data from the database. Attached is my code, which
I wrote to retrieve data. I am also pasting it here (in case, you are
not able to see attachment):

require 'dbi'

conn = DBI.connect('DBI:ODBC:MY_DSN', 'username', 'password')

sth = conn.execute("select * from table_name")
rows = sth.fetch_all()
col_names = sth.column_names
puts rows
puts col_names

Using this code, I am able to display Column Names on output screen but
not able to display Rows(data). It prints "null" value for the command
"puts rows".

Any kind of suggestion or help is highly appreciable.

Thanks in Advance.



Posted via