I have installed Pervasive V10 server x86 and odbc gem. Whenever i make a request to fetch data from the database, I get the following error "IM003 (160) Specified driver could not be loaded due to system error 1114: A dynamic link library (DLL) initialization routine failed. (Pervasive ODBC Client Interface, C:\Program Files (x86)\Pervasive Software\PSQL\bin\w3odbcci.dll)"
Failing to connect to pervasive database in Ruby on Rails using odbc
418 Views Asked by Mojoo Joseph At
2
There are 2 best solutions below
2

Guess better late than never...for me what solved the issue was set the following environment variable:
set RUBY_DLL_PATH=C:\Program Files (x86)\Pervasive Software\PSQL\bin\
@REM Start the app
bundle exec rails server -b 0.0.0.0 -p 3000
For completeness the setup I have is as follows:
- Windows 2012 r2
- Ruby 2.7.1 32-bit
gem "rails", "6.1.7"
gem 'odbc_adapter', git: 'https://github.com/patterninc/odbc_adapter.git', branch: "master"
- database.yml (I wanted it to be readonly so that is why openmode is 1 here):
development:
adapter: odbc
conn_str: "driver={Pervasive ODBC Client Interface};DBQ=MyDB;ServerName=localhost.1583;TransportHint=TCP:SPX;OPENMODE=1;"
Some other errors I ran into included:
IM002 (0) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
- This was solved by switching from a 64 bit ruby install to a 32 bit ruby install as the ODBC driver for pervasive is 32-bits on this system
odbc.o:odbc.c:(.text+0xc378): undefined reference to `rb_tainted_str_new2'
- Various make errors for the odbc gems I tried went away when I downgraded the Ruby version from 3.2 to 2.7
che/core_ext/kernel_require.rb:17:in `require': cannot load such file -- arel/visitors/bind_visitor (LoadError)
- to get around this one, I was pleasantly surprised to find that the folks at instacart had updated the odbc_adapter gem to work with the updated activerecord modules, however, I did run into another issue:
initialize: wrong number of arguments (given 7, expected 2..5) ArgumentError)
- patterninc fork then finally gave me the fork that eventually was able to look up records and return without crashing
I am now able to get queries through to Pervasive, I have yet to explore how well this work though.
The two main causes of the 1114 error are: