3 Replies Latest reply: Nov 26, 2007 4:34 PM by dvohra21 RSS

    oci8 rail connection

    590829
      I installed the new version of rail and oci8.
      (1) Test Ruby/Oracle connectivity is ok.
      (2) Test that active_record also works
      (3) Test that database.yml is parsed also correctly

      but in rail app when i try to access oracle db,
      i got these msg:

      TypeError: wrong argument type Fixnum (expected String)
      from D:/Tools/InstantRails/ruby/lib/ruby/site_ruby/1.8/oci8.rb:228:in `l
      ogon'
      from D:/Tools/InstantRails/ruby/lib/ruby/site_ruby/1.8/oci8.rb:228:in `i
      nitialize'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/connection_adapters/oracle_adapter.rb:567:in `new_connectio
      n'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/connection_adapters/oracle_adapter.rb:597:in `initialize'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/connection_adapters/oracle_adapter.rb:35:in `oracle_connect
      ion'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/connection_adapters/abstract/connection_specification.rb:25
      1:in `connection_without_query_cache='
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/query_cache.rb:54:in `connection='
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/connection_adapters/abstract/connection_specification.rb:22
      0:in `retrieve_connection'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78
      :in `connection'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/base.rb:764:in `sanitize'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/base.rb:950:in `find_one'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/base.rb:941:in `find_from_ids'
      from D:/Tools/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14
      .2/lib/active_record/base.rb:382:in `find'
      from (irb):2

      is there any one know what the problem maybe is?great thanks for your help!
        • 1. Re: oci8 rail connection
          589551
          Hi,

          What's the result if you run "rake db:migrate"? Do you use only number as the password for your database?

          If you do use number as the password, please use quotation marks to convert your password from number to string in your configuration file.

          Suppose your password is 34127, you can't write as following in your database.yml

          adapter: oci
          username: test
          password: 34127

          The correct way should be

          adapter: oci
          username: test
          password: "34127"

          This may be a bug of OCI8, hope this helpful!
          • 2. Re: oci8 rail connection
            589551
            The bug of using numeric password with Oracle adapter has been fixed in the rails's trunk. You can find the [Ticket #9874: Fix oracle numeric password error] here: http://dev.rubyonrails.org/ticket/9874.
            • 3. Re: oci8 rail connection
              dvohra21
              Please refer
              http://dev.rubyonrails.org/ticket/9874

              If numeric password without quotes is not being used and the error is still generated, reinstall Rails.