Closed mfancy-mm closed 3 years ago
Hm, I can't reproduce.
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32]
$ ruby .\scratch.rb
2.1.3.pre
{"servername"=>"c83527d2d7ff", "db_name"=>"master"}
Can you try running this script (copy/paste to something like scratch.rb
) and confirming it still gets an error? (fill in with your own connection info of course)
require 'tiny_tds'
puts TinyTds::VERSION
c = TinyTds::Client.new({
host: 'localhost',
username: 'replace_with_yours',
password: 'replace_with_yours',
timeout: 5,
login_timeout: 5,
})
connected_servername = c.execute("select @@servername servername, db_name() db_name").to_a
puts connected_servername
FWIW: win10, git-for-windows 2.26.0, ruby+devkit 2.7.1-1-x64
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
$ ruby ./scratch.rb
2.1.3.pre
{"servername"=>"snip", "db_name"=>"master"}
tested using SSPI and explicit username/password.
Interestingly I have had problems installing rake with bundler, had to use gem install rake
instead. Not sure if this irrelevant, just noting some weirdness with ruby on windows possibly with git-bash installed because x64-mingw32 is also embedded in git-bash. I am unable to test without git-bash.
Using irb I have the following results:
X:>irb
irb(main):001:0> require 'tiny_tds'
Traceback (most recent call last):
16: from C:/Ruby26/bin/irb.cmd:31:in load' 15: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in
<top (required)>'
14: from (irb):1
13: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in require' 12: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in
rescue in require'
11: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in require' 10: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:42:in
<top (required)>'
9: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:33:in block in <top (required)>' 8: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:17:in
block in <top (required)>'
7: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:24:in rescue in block in <top (required)>' 6: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:34:in
block (2 levels) in <top (required)>'
5: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:37:in block in <top (required)>' 4: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:43:in
block in <top (required)>'
3: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:46:in rescue in block in <top (required)>' 2: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
require'
1: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
LoadError (cannot load such file -- tiny_tds/tiny_tds)
irb(main):002:0>
I realize that it is trying to load some dlls. Should those dlls be in C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/ports/i686-w64-mingw32/freetds/1.1.24/bin C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/ports/i686-w64-mingw32/openssl/1.1.1d/bin
I tried loading both dlls with regsvr32 and got the error "The specified module could not be found". Are these dlls trying to load something else?
I am also unable to repro as my project successfully runs and connects to the database, here are my specifics:
Win 10 Pro Build 1903 ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32] tiny_tds (2.1.3.pre-x64-mingw32)
Also FWIW @a30004475 I had that same issue until I ran the following command at an elevated prompt c:> gem update --system
I'm also unable to repro as my test with scratch.rb work fine. Win 10 Enterprise Build 1909 ruby 2.6.6p146 (2020-03-31 revision 67876) [x64-mingw32]
ruby scratch.rb 2.1.3.pre {"servername"=>"localhost", "db_name"=>"master"}
And I did not need to run gem update
I just spent some time revisiting this issues. I uninstalled ruby and installed 2.6.3 32bit. Install tiny_tds 2.1.3.pre. This resulted in me getting the same error as before with unable to load ting_tds.so.
I have ruby 2.6.3 64bit install and have no problems running.
Since you are mentioning bit versions FWIW I am using: rubyinstaller-2.6.6-1-x64.exe msys2-x86_64-20200216 (ran all three options in "RIDK Install") tiny_tds (2.1.3.pre-x64-mingw32)
Had to download a weekly build version of the toolkit because I ran into an issue keeping MSYS up to date error here https://github.com/msys2/MSYS2-packages/issues/1298 downloaded at https://www.msys2.org/ at the top of the page.
Hm, maybe it's only an issue with 32bit? @mfancy-mm can you run gem environment
and gem info tiny_tds
in your 32bit ruby 2.6.3 installation?
Also, what is the contents of your this folder:
(wherever "gem info tiny_tds" says it's installed at)\gems\tiny_tds-2.1.3.pre-x86-mingw32\lib\tiny_tds\2.6
@mfancy-mm If you have a moment can you provide any updated information requested?
Sorry for the delay getting back to you. Here is the info requested.
gem environment RubyGems Environment:
gem info tiny_tds
LOCAL GEMS
tiny_tds (2.1.3.pre) Platform: x86-mingw32 Authors: Ken Collins, Erik Bryn, Will Bond Homepage: http://github.com/rails-sqlserver/tiny_tds License: MIT Installed at: C:/Ruby26/lib/ruby/gems/2.6.0
TinyTDS - A modern, simple and fast FreeTDS library for Ruby using
DB-Library.
dir c:\Ruby26\lib\ruby\gems\2.6.0\gems\tiny_tds-2.1.3.pre-x86-mingw32\lib\tiny_tds\2.6 Volume in drive C is OSDisk Volume Serial Number is 4E7D-A2DA
Directory of c:\Ruby26\lib\ruby\gems\2.6.0\gems\tiny_tds-2.1.3.pre-x86-mingw32\lib\tiny_tds\2.6
06/08/2020 11:05 AM
Can you provide an update for next steps @aharpervc ?
The next steps are for someone to figure out why 2.1.3.pre doesn't seem to load with 32bit ruby 2.6. I myself don't know why this is happening. I think this is a blocker for publishing the final release, because if we publish a broken release that will create a lot of pain for people, which I think we'd all prefer to avoid.
We're all open to ideas! One thing I thought of is if someone with this environment can build their own copy of the gem and it works, then maybe we can compare it to the current gem and see what's up.
This looks to be a problem with the freetds
installation to me. Testing with 32bit ruby 2.6 I get the exact same error if I uninstall freetds
. Reinstalling freetds
gets things working again. @mfancy-mm does the error occur on your machine with another tiny_tds
version? Can you verify your installation of freetds
is working (e.g. tsql -C
returns info)?
$ irb
irb(main)> require 'tiny_tds'
=> true
$ ridk exec pacman -R mingw-w64-i686-freetds
checking dependencies...
Packages (1) mingw-w64-i686-freetds-1.00.99-1
Total Removed Size: 13.78 MiB
:: Do you want to remove these packages? [Y/n] Y
:: Processing package changes...
(1/1) removing mingw-w64-i686-freetds
$ irb
irb(main):001:0> require 'tiny_tds'
Traceback (most recent call last):
16: from C:/Ruby26/bin/irb.cmd:31:in `load'
15: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
14: from (irb):1
13: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
12: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
11: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
10: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:42:in `<top (required)>'
9: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:33:in `block in <top (required)>'
8: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:17:in `block in <top (required)>'
7: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:24:in `rescue in block in <top (required)>'
6: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:34:in `block (2 levels) in <top (required)>'
5: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:37:in `block in <top (required)>'
4: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:43:in `block in <top (required)>'
3: from C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds.rb:46:in `rescue in block in <top (required)>'
2: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
1: from C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
LoadError (cannot load such file -- tiny_tds/tiny_tds)
$ ridk exec pacman -S mingw-w64-i686-freetds
resolving dependencies...
looking for conflicting packages...
Packages (1) mingw-w64-i686-freetds-1.00.99-1
Total Installed Size: 13.78 MiB
:: Proceed with installation? [Y/n] Y
(1/1) checking keys in keyring
(1/1) checking package integrity
(1/1) loading package files
(1/1) checking for file conflicts
(1/1) checking available disk space
:: Processing package changes...
(1/1) installing mingw-w64-i686-freetds
$ ridk exec tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v1.00.99
freetds.conf directory: /mingw32/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: auto
iODBC: no
unixodbc: yes
SSPI "trusted" logins: yes
Kerberos: no
OpenSSL: yes
GnuTLS: no
MARS: no
$ irb
irb(main):001:0> require 'tiny_tds'
=> true
@mfancy-mm can you provide an update? Thanks!
I agree its the freetds installation. It appears my msys2 is messed up. Any thoughts?
ridk.cmd exec pacman -S mingw-w64-i686-freetds error: mingw32: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely error: mingw64: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely error: database 'mingw32' is not valid (invalid or corrupted database (PGP signature)) error: database 'mingw64' is not valid (invalid or corrupted database (PGP signature)) error: database 'msys' is not valid (invalid or corrupted database (PGP signature))
I ran into this same issue recently and is documented at https://www.msys2.org/news/#2020-06-29-new-packagers
I had to run all these steps:
Open MSYS2 MSYS as an administrator
a. $ rm -r /etc/pacman.d/gnupg/
b. $ pacman-key --init
c. $ pacman-key --populate msys2
d. $ curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
e. $ curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig
f. $ pacman -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
g. $ pacman -U --config <(echo) msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
h. $ pacman –Syu
i. If asked Answer Y to import PGP key
j. If you receive the inability to import PGP key error repeat step a-g and it will prompt to apply an update on f-g on the second round. If you receive a pacman error of “error: no operation specified” then continue.
k. Make sure all MSYS2 MSYS actions are finished by killing the processes.
l. Open PowerShell as admin.
m. $ Get-Process | Where-Object {$_.path -like 'C:\msys64*'} | Stop-Process
n. Open command prompt as an administrator
o. $ RIDK Install
p. Complete 1,2,3
This is fighting my every inch off they way.
ridk.cmd exec pacman -S mingw-w64-i686-freetds resolving dependencies... looking for conflicting packages...
Packages (6) mingw-w64-i686-ca-certificates-20190110-1 mingw-w64-i686-libffi-3.3-1 mingw-w64-i686-libtasn1-4.16.0-1 mingw-w64-i686-openssl-1.1.1.g-1 mingw-w64-i686-p11-kit-0.23.20-2 mingw-w64-i686-freetds-1.1.42-1
Total Installed Size: 89.74 MiB
:: Proceed with installation? [Y/n] y (6/6) checking keys in keyring [######################################################################################] 100% (6/6) checking package integrity [######################################################################################] 100% (6/6) loading package files [######################################################################################] 100% error: could not open file /var/cache/pacman/pkg/mingw-w64-i686-freetds-1.1.42-1-any.pkg.tar.zst: Child process exited with status 127 error: failed to commit transaction (cannot open package file) Errors occurred, no packages were upgraded.
Looks to me you have a corrupt package download in the cache. Try removing the package and retrying the above steps. As a last resort you can also clear all the pacman cache by issuing a # pacman -Scc
You could also try a newer installation package at https://www.msys2.org/wiki/MSYS2-installation/
Finally got tiny_tds working in 2.6.3 32 bit version. Once freetds was installed everything just started to work. I had to go thought some hoops to get freetds installed. This now leaves me with the question is there a bug in tiny_tds 32 bit version?
I don't believe so, but perhaps @aharpervc can give the specifics?
Finally got tiny_tds working in 2.6.3 32 bit version. Once freetds was installed everything just started to work. I had to go thought some hoops to get freetds installed. This now leaves me with the question is there a bug in tiny_tds 32 bit version?
Does that mean your original question is resolved? Can you run the scratch script I posted above? Does it work without error? https://github.com/rails-sqlserver/tiny_tds/issues/465#issuecomment-626985049
If that works, then I think that means that 2.1.3.pre is fine, and this issue no longer blocks it's release, and we can get that final version published.
@mfancy-mm can you provide an update? Thanks!
The day I got this working was on a new system. My steps were
Thus on a clean system installing tiny_tds for the first time doesn't install freetds correctly.
I did have issue install freetds manual due to VPNs, firewalls. Maybe tiny_tds ran into the same issue. Then again my old system installed 64 bit with out an issue.
Looks like this issue is closed and we can proceed to push a release version of 2.1.3?
I think so, yes... I'll try to look into it this or next week unless someone else cuts the release first
Closing this, since it looks like it wasn't an issue with tiny_tds itself
I on Windows 10 running ruby 2.6.3p62 (2019-04-16 revision 67580) [i386-mingw32] I have tiny_tds (2.1.3.pre x86-mingw32) installed When I try to execute me code I get
C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': 126: The specified module could not be found. - C:/Ruby26/lib/ruby/gems/2.6.0/gems/tiny_tds-2.1.3.pre-x86-mingw32/lib/tiny_tds/2.6/tiny_tds.so (LoadError)
C:/Ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- tiny_tds/tiny_tds (LoadError)
I would have expected this to work.