开发者

Connecting to SQL Server 2005 from a ROR application in Ubuntu

I tried to connect to SQL Server from a ROR application in Ubuntu. For that I did the following things.

I installed the following libraries in my Ubuntu 10.04

  • unixodbc
  • unixodbc-dev
  • freetds-dev
  • libdbd-odbc-ruby
  • tdsodbc

After installing these, I created the dsn and made the required changes in odbc.ini and freetds.conf files.

Then I tested the connection using "tsql" like below

tsql -S <dsn name> -U <username> -P <pwd>

For this command, I am getting the following error

Adaptive Server is unavailable

I also checked the freetds log; it is saying "connection timedout".

I am sure that we are fine with the configurations (remote) in our SQL Server side.

When I run ts开发者_如何转开发ql -C it is saying TDS Version is 5. I am not sure how it is saying TDS 5, because I installed the latest FreeTDS version. And I don't know how to update my TDS version.

FYI, I heard that TDS version 5 can't be used for making connections with SQL Server. Is that right?

Please guide me

Thanks, Neo


freetds.conf allows you to specify which version of the TDS protocol you want to use. Just add a tds version = 8.0 under the [global] section or the section you added for your server. If not specified, it defaults to version 5.0, which seems to be your case. For more info, look at http://www.freetds.org/userguide/freetdsconf.htm


I realize this is not an answer to your specific question, but it is some advice from the last time I tried to go from Linux to SQL Server. It was back in 2009, so it's possible something has changed since then.

Anyway, we had so much trouble with it we gave up and decided to use JRuby.

It resulted in very little effort to get the connection up and running using activerecord-jdbc-adapter and we've run into no problems with compatibility. (I take that back, there was one problem I had to fix where we were selecting limited rows in mssql from table with no primary key, identity column, or column named "id")

I have been able to get it working in the past doing it like you're trying to, but it was always a lot more effort than I had to go through with JRuby.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜