Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
MS SQL Server connection via Ruby
David Lee
10/10/2007 10:32:00 AM
I am running Ruby on Fedora Core 6 and I am running into problems I do
not see on my windows box. Any help would be awesome - its been 2 days
I tried everything and even installed unixODBC and that worked but
installing freeTDS ha problems. Can someone guide me into getting this
to work?
def test_connection
begin
connect( "DBI:ODBC:Driver={SQL
Server};Server=#{@adapter_config["acct_db_host"]};Database=#{@adapter_config["acct_db_name"]};Uid=#{@adapter_config["acct_db_user"]};Pwd=#{@adapter_config["acct_db_pass"]}"
)
is_connected
rescue DBI::DatabaseError => e
puts "Error #{e.errstr}"
rollback
ensure
#disconnect from server
disconnect
end
end
/usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:511:in `load_driver': Could not
load driver (no such file to load -- odbc) (DBI::InterfaceError)
from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:401:in
`_get_full_driver'
from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:381:in `connect'
from ./database_adapter.rb:77:in `connect'
from ./database_adapter.rb:65:in `test_connection'
from ./game_adapter.rb:6:in `initialize'
from ./ballerium/ballerium_adapter.rb:6:in `initialize'
from ./game_adapter_factory.rb:14:in `new'
from ./game_adapter_factory.rb:14:in `get_adapter'
from test.rb:11
--
Posted via
http://www.ruby-...
.
1 Answer
Damjan Rems
10/10/2007 11:01:00 AM
0
David Lee wrote:
> I am running Ruby on Fedora Core 6 and I am running into problems I do
> not see on my windows box. Any help would be awesome - its been 2 days
> I tried everything and even installed unixODBC and that worked but
> installing freeTDS ha problems. Can someone guide me into getting this
> to work?
I was able to install freetds on ubuntu 7.04. This is my /tmp/odbc.ini
part.
[TESTSQL]
Driver = FreeTDS
Description = FreeTDS SQL Server ODBC driver
Server = testsql.my.com
Port = 1433
Database = ruby
User =
Password =
Mars_Connection = No
Logging = 0
LogFile =
QuotedId = Yes
AnsiNPW = Yes
Language =
Version7 = No
ClientLB = No
Failover_Partner =
VarMaxAsLong = No
And am using DBI odbc driver.
require 'dbi'
dbs = DBI.connect('DBI:ODBC:TESTSQL', 'usr', 'pwd')
It works with rails too, minus UTF-8 support. But that can be managed
too.
by
TheR
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
MS SQL Server connection via Ruby
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password