rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
972 stars 559 forks source link

TinyTDS driver does not observe :host or :port options #90

Closed tadman closed 13 years ago

tadman commented 13 years ago

The TinyTDS driver mode appears to require the :dataserver option and refuses to start without it even though TinyTDS::Client supports "configurationless" mode. These values are imported from database.yml but ignored.

It would be nice to have this and it shouldn't be a big deal.

metaskills commented 13 years ago

Good point, I forgot to look at putting those hooks in! Will get that done soon.

tadman commented 13 years ago

Thanks! Managing freetds.conf for different environments is kind of annoying.

Here's my preliminary hack-patch which might help as a reference: https://gist.github.com/922367

metaskills commented 13 years ago

Whoa, is that needed? I just added these two lines. https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/commit/ffab38df11ad2315433bdc97b3d5a0b512a21015

Can you confirm that work in the 3.0.13 version?

metaskills commented 13 years ago

Whoops, looks like I left in the raise, lemme fix that.

metaskills commented 13 years ago

OK, I did that for both 2.x and 3.x branches. Please let me know if that works. Thanks!

tadman commented 13 years ago

Doesn't seem to be working for me without a freetds.conf file. Removing the dataserver configuration entry gives an error:

TinyTds::Error: Adaptive Server connection failed
from /opt/local/rvm/gems/ruby-1.9.2-p180/gems/tiny_tds-0.4.4/lib/tiny_tds/client.rb:64:in `connect'

Removing the entry in the freetds.conf for that dataserver gives another error:

TinyTds::Error: closed connection
from .../activerecord-sqlserver-adapter-eafcf1f608f1/lib/active_record/connection_adapters/sqlserver_adapter.rb:387:in `execute'

Was hoping this could work without only the database.yml file, but not there yet.

metaskills commented 13 years ago

Are you using the the latest FreeTDS 0.91.dev?

On Apr 20, 2011, at 11:42 AM, tadman wrote:

Doesn't seem to be working for me without a freetds.conf file. Removing the dataserver configuration entry gives an error:

TinyTds::Error: Adaptive Server connection failed from /opt/local/rvm/gems/ruby-1.9.2-p180/gems/tiny_tds-0.4.4/lib/tiny_tds/client.rb:64:in `connect'

Removing the entry in the freetds.conf for that dataserver gives another error:

TinyTds::Error: closed connection from .../activerecord-sqlserver-adapter-eafcf1f608f1/lib/active_record/connection_adapters/sqlserver_adapter.rb:387:in `execute'

Was hoping this could work without only the database.yml file, but not there yet.

Reply to this email directly or view it on GitHub: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/90#comment_1033482

tadman commented 13 years ago

Using 0.82 which is the current MacPorts version. I can get the connection to work using the TinyTDS::Client driver directly though, and the target Ubuntu install is 0.82-7 as well. What's interesting is the client connection works on the 0.82-7 version, but not the other.

metaskills commented 13 years ago

I can not guarantee which version of 0.8 will work if at all on the new :host/:port option. I use my own MacPort file to install 0.9.dev. Should be released soon.

tadman commented 13 years ago

Thanks for the help though. It'll sort itself out in time, seems like.

metaskills commented 13 years ago

It is real easy to download and install FreeTDS 0.91. Some users on the adapter list have written a homebrew port file. I myself wrote a MacPort file.

https://github.com/metaskills/macports https://github.com/metaskills/macports/blob/master/databases/freetds/Portfile

Every few days I have to change the version to match the directory and the md5, but works great.