E
Eli Tucker
Can someone give me a little help with DBI when connecting to SQL
Server? I've dug around a bit, but can't get a simple select statement
to work. Here's what I'm trying:
require 'dbi'
db = DBI.connect("DBI:ODBC:driver={SQL
Server};Server=kint;Database=MyJournal;UID=test;PWD=test")
sql = "SELECT * from UserInfo"
db.select_all(sql) do |row|
row.each_value do |value|
puts value
end
end
db.disconnect
I get the following error:
c:/tools/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:78:in `connect':
S1090 (0) [Microsoft][ODBC Driver Manager] Invalid string or buffer
length (DBI:atabaseError)
from c:/tools/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:550:in `connect'
from c:/tools/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:367:in `connect'
from sql.rb:2
I'm using the one-click windows installation (ruby 1.8.1 (2004-01-27)
[i386-mswin32]).
Thanks,
Eli
Server? I've dug around a bit, but can't get a simple select statement
to work. Here's what I'm trying:
require 'dbi'
db = DBI.connect("DBI:ODBC:driver={SQL
Server};Server=kint;Database=MyJournal;UID=test;PWD=test")
sql = "SELECT * from UserInfo"
db.select_all(sql) do |row|
row.each_value do |value|
puts value
end
end
db.disconnect
I get the following error:
c:/tools/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:78:in `connect':
S1090 (0) [Microsoft][ODBC Driver Manager] Invalid string or buffer
length (DBI:atabaseError)
from c:/tools/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:550:in `connect'
from c:/tools/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:367:in `connect'
from sql.rb:2
I'm using the one-click windows installation (ruby 1.8.1 (2004-01-27)
[i386-mswin32]).
Thanks,
Eli