Skip to content

Undefined method connect for TinyTds::Client In Windows #349

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

Closed
sithara opened this issue Mar 10, 2017 · 15 comments
Closed

Undefined method connect for TinyTds::Client In Windows #349

sithara opened this issue Mar 10, 2017 · 15 comments

Comments

@sithara
Copy link

sithara commented Mar 10, 2017

I 'm trying to install tiny_tds in my windows machine.

This is the result I get when I tsql -C

[TinyTds][v1.1.0][tsql]: C:/Ruby22/lib/ruby/gems/2.2.0/gems/tiny_tds-1.1.0-x86-
ingw32/exe/tsql.EXE

This is the error message I get when I try executing
TinyTds::Client.new(username: "xx", password: "xxx", host: "xxxx", database: "xxxxxx")


NoMethodError: undefined method `connect' for #<TinyTds::Client:0x2eda828>
       from C:/Ruby22/lib/ruby/gems/2.2.0/gems/tiny_tds-1.1.0-x86-mingw32/lib/t
iny_tds/client.rb:53:in `initialize'
       from (irb):12:in `new'
       from (irb):12
       from C:/Ruby22/bin/irb:11:in `<main>'

@metaskills
Copy link
Member

Hmm... I have not seen that one before. I hints at no compiled binary. Could you please install the latest 1.2.0 prerelease. You can do that by bundling to 1.2.0.beta1 in your Gemfile or by doing gem install tiny_tds --pre. Which ever works for you. Interested in hearing if that helps.

metaskills pushed a commit that referenced this issue Mar 12, 2017
* Use OpenSSL v1.1.0e & FreeTDS v1.00.27 for Windows builds.
* Adapt dll names to 1.1.0 scheme
 - libeay -> libcrypto
 - ssleay -> libssl
* Use perl in Git installation for openssl
* OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8. To overcome this, prepend Git's usr/bin to the PATH. It has MSYS2 with a recent version of perl.
* MinGW: Fix inet_pton also for 32-bit
@metaskills
Copy link
Member

Pull Request #347 pulled in OpenSSL v1.1.0 and we got new versions of TinyTDS at v1.2.0 which should solve this issue. Please reply back and let us know.

@sithara
Copy link
Author

sithara commented Mar 13, 2017

NoMethodError: undefined method connect' for #<TinyTds::Client:0x2b77ba0> from C:/Ruby22/lib/ruby/gems/2.2.0/gems/tiny_tds-1.2.0.beta1-x86-mingw32 /lib/tiny_tds/client.rb:53:in initialize'
from (irb):7:in `new'
from (irb):7

Same error :(

@metaskills metaskills reopened this Mar 13, 2017
@metaskills
Copy link
Member

Ouch! Would you mind trying the official release of v1.2.0? I doubt it would be different but worth a shot. What platform are you on? Can you do a gem fetch and unpack (google it) to see if the lib/tiny_tds/tiny_tds is present? Maybe try a require 'tiny_tds/tiny_tds' in IRB before hand?

@sithara
Copy link
Author

sithara commented Mar 14, 2017

@metaskills Yes the require 'tiny_tds' does not work . It throws an error. But it says my gem has installed successfully. I'm on windows 7 !

@metaskills
Copy link
Member

@sithara Sorry to hear about the problems. Could you try to find a version that works for you? Using this list (https://rubygems.org/gems/tiny_tds/versions) jumping to each last minor release. Ex:

$ gem install -v 0.9.5.rc.3
$ irb
> gem 'tiny_tds, '0.9.5.rc.3'
> require 'tiny_tds'
> # test connection 

And then like below to the next. And so on.

$ gem install -v 0.7.0
$ irb
> gem 'tiny_tds, '0.7.0'
> require 'tiny_tds'
> # test connection 

I'd be interested in if an older version worked for you on Windows 7.

@orgads
Copy link
Contributor

orgads commented Mar 15, 2017

libsybdb-5.dll depends on libgcc_s_sjlj-1.dll which is not installed by default.

Maybe we should use -static-libgcc for freetds?

@coderjoe
Copy link
Contributor

That might work around it for the 1.2 branch. Another work around is to ensure devkit is loaded in your path before loading the project. Devkit comes with the appropriate libgcc_s_sjlj-1.dll for its build environment.

@orgads
Copy link
Contributor

orgads commented Mar 15, 2017

Right, but most users don't have devkit...

@coderjoe
Copy link
Contributor

True but until the real issue is fixed it's very simple to install devkit and rails installer seems to come with it pre-installed correct?

orgads added a commit to orgads/tiny_tds that referenced this issue Mar 15, 2017
@orgads
Copy link
Contributor

orgads commented Mar 15, 2017

For some reason, I can't build freetds locally (with 32-bit). Is there a way to grab the artifacts from AppVeyor?

@coderjoe
Copy link
Contributor

I don't think the appveyor build builds binary artifacts. That has to be done locally via the rake-compiler-dock via the gem:windows rake task I believe. Thank you for the PR btw. :)

orgads added a commit to orgads/tiny_tds that referenced this issue Mar 16, 2017
orgads added a commit to orgads/tiny_tds that referenced this issue Mar 16, 2017
orgads added a commit to orgads/tiny_tds that referenced this issue Mar 16, 2017
@sithara
Copy link
Author

sithara commented Mar 17, 2017

@metaskills I was able to require 'tiny_tds' without any error using using version 0.9.5.rc.3

But now I get

TinyTds::Error: Adaptive Server connection failed (xxx:1433)
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/tiny_tds-0.9.5.rc.3-x86-mingw32/
lib/tiny_tds/client.rb:43:in `connect'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/tiny_tds-0.9.5.rc.3-x86-mingw32/
lib/tiny_tds/client.rb:43:in `initialize'
        from (irb):6:in `new'
        from (irb):6
        from C:/Ruby22/bin/irb:11:in `<main>'

While executing tsql -C I get

[TinyTds][v0.9.5.rc.3][tsql]: C:/Ruby22/lib/ruby/gems/2.2.0/gems/tiny_tds-0.9.5.
rc.3-x86-mingw32/exe/tsql.EXE

When I try running this .exe I get missing a libeay32-1.0.2f-x86-64-w64-mingw32.dll file error

@metaskills
Copy link
Member

Could you please try v1.3.0 that was released today?

@metaskills metaskills reopened this Mar 18, 2017
@zbychfish
Copy link

"When I try running this .exe I get missing a libeay32-1.0.2f-x86-64-w64-mingw32.dll file error"
Fresh installation of Tiny_TDS does not change windows path variable. Please add to path the directory where static libraries are located and tsql will work.

aharpervc pushed a commit to aharpervc/tiny_tds that referenced this issue Apr 9, 2020
…qlserver#310 rails-sqlserver#290 rails-sqlserver#349 rails-sqlserver#323 rails-sqlserver#330

* Use OpenSSL v1.1.0e & FreeTDS v1.00.27 for Windows builds.
* Adapt dll names to 1.1.0 scheme
 - libeay -> libcrypto
 - ssleay -> libssl
* Use perl in Git installation for openssl
* OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8. To overcome this, prepend Git's usr/bin to the PATH. It has MSYS2 with a recent version of perl.
* MinGW: Fix inet_pton also for 32-bit
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

5 participants