Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyTds::Error (Adaptive Server connection failed) on Rails 6.0.3.1 / rbenv #472

Closed
jbwl opened this issue Jun 16, 2020 · 1 comment
Closed

Comments

@jbwl
Copy link

jbwl commented Jun 16, 2020

I have a multi-Ruby system with rbenv.
The app with said error runs on Rails 6 / Ruby 2.7.1 / tiny_tds 2.12

I have checked these bullet points:

  • Using Ubuntu? If so, you may have forgotten to install FreeTDS first.

I installed FreeTDS 1.1.42 from source with configure, make, sudo make install

  • Are you using FreeTDS 0.95.80 or later? Check $ tsql -C to find out.

Yes, see below.

Environment

Operating System

Ubuntu 20.04 LTS

TinyTDS Version and Information

tsql-ttds -C                                                                                                                                                                                                                                                 [TinyTds][v2.1.2][tsql]: /usr/local/bin/tsql
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.1.42
             freetds.conf directory: /usr/local/etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: auto
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: yes

FreeTDS Version
1.1.42

Description

When I type "tsql -C" anywhere, I am getting the following:

rbenv: tsql: command not found

The `tsql' command exists in these Ruby versions:
  2.3.1

this is a tsql from another Ruby environment which I do not use for this Rails app.

The correct binary is the one FreeTDS has installed tsql into /usr/local/bin, and works from the command line (output of tsql -C see below). I can also connect to a server using that tsql from the command line, and do queries etc.

But I cannot connect in the Rails app using tiny_tds:

TinyTds::Error (Adaptive Server connection failed)

Inside my 2.7.1 bundle with tiny_tds, I do not have a tsql command, only a tsql-ttds command which correctly points to /usr/local/bin/tsql

I have a hunch that this error is caused by the tiny_tds gem wants to call the "tsql" command instead of the "tsql-ttds" command to connect, and cannot find it because of above situation. Is this a PATH var issue, if yes, please let me know where to set the path so the tiny_tds gem finds the tsql bin.

If there is a way to get a more verbose error description from tiny_tds, that could help as well.

@jbwl
Copy link
Author

jbwl commented Jun 16, 2020

Recompiling FreetTDS with setting TDS version to 7.1 fixed the issue.

@jbwl jbwl closed this as completed Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant