kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Oci8.dll not found despite perfect setup - only in AWS Windows EC2 Instance #151

Closed kumzme closed 7 years ago

kumzme commented 7 years ago

Instantclient is installed and path is updated in Windows.

Its trying to find a path in xxx and unable to find it and raises a Error. Oci8 2.2.2 as well as 2.2.3. Same copy of libraries and also same installation in non AWS is not raising this issue in windows nor MAC nor RHEL Linux.

 case RUBY_VERSION
  when /^1\.9\.0/
......
  else
    so_basename += RUBY_VERSION.gsub(/(\d+)\.(\d+).(.*)/, '\1\20')
  end
.....else
  raise 'unsupported ruby engine: ' + RUBY_ENGINE
end

begin
  **_require so_basename_**  #Comes here
rescue LoadError, OCIError
  require 'oci8/check_load_error' #Comes here
  OCI8::Util::check_load_error($!)  #Comes here
  raise
end
   def self.check_os_specific_load_error(exc)
        case exc.message  **#Comes here But does not go forward to checking the next line**
        when /^193: / # "193: %1 is not a valid Win32 application." in English
          check_win32_pe_arch(exc.message.split(' - ')[1], "ruby-oci8")
          dll_load_path_list.each do |path|
            check_win32_pe_arch(File.join(path, '\OCI.DLL'), "Oracle client")
          end
        end
      end # self.check_os_specific_load_error

here as soon as it reaches case exc.message it goes back to its calling lines

def self.check_load_error(exc)
  **_check_os_specific_load_error(exc)_**  **#Comes here **
  **case exc.message**    
  when /^OCI Library Initialization Error/
    # TODO
  end
end

I dont know if I am looking at it right - but i could verify OCI8.DLL in the folders specified in path.

kubo commented 7 years ago

What version of Oracle instant client do you use? Could you run sqlplus in the AWS instance? It won't work if you use Oracle instant client 12.1.0.2, which depends on MSVCR100.dll, and the AWS instance lacks Microsoft Visual C++ 2010 Redistributable Package, which provides MSVCR100.dll.

kubo commented 7 years ago

I'll close this issue because of no reply. If the error message you got is OCI.DLL: 126(The specified module could not be found. ) (LoadError), look at this page. Could you check whether MSVCR100.dll is in the AWS instance? If it doesn't help you, let me know. I'll reopen this issue.