rails-sqlserver / tiny_tds

TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
Other
605 stars 191 forks source link

Unable to connect when upgrade to Rials 6 #518

Open weijenlarryli opened 1 year ago

weijenlarryli commented 1 year ago

Environment

Operating System NAME="Ubuntu" VERSION="16.04.5 LTS (Xenial Xerus)"

TinyTDS Version and Information tiny_tds (2.1.2)
I also tried 2.1.5

FreeTDS Version MS db-lib source compatibility: no Sybase binary compatibility: yes Thread safety: yes iconv library: yes TDS version: 4.2 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: yes

Description

I have used Rails 5 with TinyTds gem to connect to many servers. (hundreds of them) I recently upgrated to Rails 6. My system can connect to most of the servers, but cannot connect to some. When I start a client side, I get this error:

TinyTds::Error: Unable to connect: Adaptive Server is unavailable or does not exist (some.server.address:1433)
from ....gems/tiny_tds-2.1.2/lib/tiny_tds/client.rb:60:in `connect'

Is there any way to figure out why I cannot connect? I can connect when I switch back to Rails 5.

Thanks.

aharpervc commented 1 year ago

TinyTDS can't really tell you anything that FreeTDS isn't already saying; ie, it can't connect for some reason. The diagnostics are up to you. Here's some ideas to get you started:

  1. Is the FreeTDS info otherwise identical?
  2. Is the TDS version the same (4.2 is very old)
  3. Can you connect to from this web server to that SQL Server instance using other tools (eg, tsql)
  4. Does the SQL Server log show anything interesting when you try to connect?
weijenlarryli commented 1 year ago
  1. Yes they are identical.
  2. The version seems old. Are the versions backward compatible?
  3. Yes, I can connect using command like tsql -S [hostname] -U [user] -P [password] But unable to connect using TinyTds::Client from rails_console.
  4. Have not been able to see the SQL server logs. I will try this.
weijenlarryli commented 1 year ago

Adding a follow up to this. Here are discussions and solutions: https://github.com/FreeTDS/freetds/issues/336 https://github.com/FreeTDS/freetds/issues/299