Skip to content

Instantly share code, notes, and snippets.

@toamitkumar
Created April 12, 2011 04:19
Show Gist options
  • Save toamitkumar/914923 to your computer and use it in GitHub Desktop.
Save toamitkumar/914923 to your computer and use it in GitHub Desktop.
1) Download and install FreeTDS
2) Configure FreeTDS (make an entry inside /usr/local/etc/freetds.conf)
[free_tds_server]
host = <sql server>
port = 1433
tds version = 8.0
encryption = no
3) Install ruby gems
i) gem install activerecord-sqlserver-adapter
ii) gem install tiny_tds
4) database.yml
development:
adapter: sqlserver
mode: dblib
dataserver: my_sql_server
database: my_database_name
username: my_username
password: xxxxx
timeout: 5000
@metaskills
Copy link

FreeTDS is still a dependency to which TinyTDS compiles against. However, the freetds.conf is no longer needed with the new host/port options. You can just use them instead of a dataserver.

@toamitkumar
Copy link
Author

I am getting:

ArgumentError: Missing :dataserver configuration.
from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-sqlserver-adapter-3.0.12/lib/active_record/connection_adapters/sqlserver_adapter.rb:25:in `sqlserver_connection'

from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `send'

from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `new_connection'

from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:237:in `checkout_new_connection'

from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:191:in `checkout'

from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:187:in `loop'

from /Users/toamitkumar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:187:in `checkout'

from /Users/toamitkumar/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'

@toamitkumar
Copy link
Author

development:
adapter: sqlserver
mode: dblib
host:
port: 1433
database: hsidb
username: hsiuser
password: hsiuser123
timeout: 5000

@metaskills
Copy link

Are you using the latest v0.4.4 of TinyTDS? Also what version of FreeTDS are you using?

@toamitkumar
Copy link
Author

TinyTDS version 0.4.4
and FreeTDS version 0.82

@metaskills
Copy link

I am testing now, but this might be something that only works in the soon to be released 0.91 of FreeTDS :(

@toamitkumar
Copy link
Author

aaahh ok
going to pull 0.91 from nightly builds and testing it

@metaskills
Copy link

This is the one in the project ports file.
http://www.ibiblio.org/pub/Linux/ALPHA/freetds/current/freetds-current.tgz

FYI, you should be able to clone the repo and do:

$ rake compile
$ rake native gem

And that will make a gem for your system. You can then move it around and do "gem install 'thatgemfile'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment