Ruby connnection string for sql server 2005

S

Shirish Nagar

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.

Attachments:
http://www.ruby-forum.com/attachment/5334/Ruby-ODBC.txt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top