Description
On Windows 10 I've got a small Rails 5 app and after discovering tiny_tds / sqlserver adapter don't support Rails v5 yet I created a quick version 4.2.6 Rails app to test connectivity to SQLEXPRESS. At first things seemed to work as after installing tiny_tds / sqlserver adapter, as I was able to successfully update a SQLEXPRESS DB using rake db:schema:load in the Rails root dir. However when I actually run the rails app itself, the app fails to load.
tiny_tds.rb is unable to require "tiny_tds/#{ver}/tiny_tds"
The LoadError is this message:
193: %1 is not a valid Win32 application. - C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tiny_tds-1.0.4-x64-mingw32/lib/tiny_tds/2.2/tiny_tds.so
And after trying to rescue with require "tiny_tds/tiny_tds" I see:
Uncaught exception: cannot load such file -- tiny_tds/tiny_tds
Which is correct because tiny_tds is at the first location attempted but Windows says it's a bad file type.
Here is the actual path to the tiny_tds.so:
C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\tiny_tds-1.0.4-x64-mingw32\lib\tiny_tds\2.2
Here was the install:
C:\Code\PET\Spikes\ReportAppV4>gem install tiny_tds --platform=x64-mingw32
Successfully installed tiny_tds-1.0.4-x64-mingw32
Parsing documentation for tiny_tds-1.0.4-x64-mingw32
Installing ri documentation for tiny_tds-1.0.4-x64-mingw32
Done installing documentation for tiny_tds after 1 seconds
1 gem installed
gem list
…
tiny_tds (1.0.4 x64-mingw32)
…
And RubyGems Env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5.1
- RUBY VERSION: 2.2.4 (2015-12-16 patchlevel 230) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby22-x64/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: C:/Ruby22-x64/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby22-x64/bin
This looks to me like the .so being pre-built is not being recognized by Windows 10 as a dll type file, indicating maybe Windows 10 isn't supported yet -- couldn't find in the TinyTDS
Also here is the path before tiny_tds.rb saves it and just before requiring:
old path =
C:/Ruby22-x64/lib/ruby/gems/2.2.0/bin;C:\Ruby22-x64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\1E\NomadBranch;C:\Code\Tools\DevKit\bin;C:\Code\Tools\DevKit\mingw;C:\Code\Tools\DevKit\mingw\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Code\Tools\WebDrivers;C:\Program Files\nodejs\
altered path:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tiny_tds-1.0.4-x64-mingw32/ports/x86_64-w64-mingw32/bin;C:/Ruby22-x64/lib/ruby/gems/2.2.0/bin;C:\Ruby22-x64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\1E\NomadBranch;C:\Code\Tools\DevKit\bin;C:\Code\Tools\DevKit\mingw;C:\Code\Tools\DevKit\mingw\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Code\Tools\WebDrivers;C:\Program Files\nodejs\
I've tried to compile this on my (rather standard) Windows 10 but will have to work harder on that since the compile blew up (maybe I need FreeTDS from somewhere first).
Anyway I thought that it's incorrect for Windows 10 to cough on the pre-compiled gem and say it's not a valid file type, worth maybe letting y'all know. I'm happy to debug further if it will help.