kubo / ruby-oci8

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

Oracle 12c OCIError: Message 1359481369 not found #87

Closed areman closed 9 years ago

areman commented 9 years ago

Hello guys,

I'm using ruby oci with an oracle 12c. Sometime a error like ... OCIError: ORA-1359481369: Message 1359481369 not found; product=RDBMS; facility=ORA: SELECT count(*) as i_itemqty FROM ... is raised. I'm not sure whats the problem is. Can anybody give me a hit how to fix it ?

Best Regards, André

kubo commented 9 years ago

Could you post more detailed information to reproduce the issue?

kubo commented 9 years ago

Close this issue because nobody can fix a bug without information. If you can reproduce it, please report it again.

dbernheisel commented 8 years ago

@areman did you ever figure it out? I'm running into a similar issue with ruby 1.9.3p551, ruby-oci8 2.2.2, 12c on a redhat server. For me, the issue comes up when querying against a database view that has a program_id column, but it's really inconsistent. In one moment, MyDbViewModel.where(program_id: 123) didn't work, but then MyDbViewModel.where('program_id = ?', 123) did work; but then both styles immediately started working.

EDIT -- added details.

select * from v$version;

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE    12.1.0.2.0  Production
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production

Crashing query: MyDbViewModel.where(program_id: 10002) When I use the generated query in SQLDeveloper on the same database, it works just fine.

ActiveRecord::StatementInvalid: OCIError: ORA--1023278845: Message -1023278845 not found;  product=RDBMS; facility=ORA: SELECT "REPORT_VIEW".* FROM "REPORT_VIEW" WHERE "REPORT_VIEW"."PROGRAM_ID" = 10002
    from stmt.c:243:in oci8lib_191.so
    from /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.2.2/lib/oci8/cursor.rb:126:in `exec'
    from /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.2.2/lib/oci8/oci8.rb:276:in `exec_internal'
    from /usr/local/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.2.2/lib/oci8/oci8.rb:267:in `exec'
    from /***/.bundler/ruby/1.9.1/oracle-enhanced-3580c7a47d28/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:482:in `exec'
    from /***/.bundler/ruby/1.9.1/oracle-enhanced-3580c7a47d28/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:180:in `select'
    from /***/.bundler/ruby/1.9.1/oracle-enhanced-3580c7a47d28/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1281:in `block in select'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `block in log'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
    from /***/.bundler/ruby/1.9.1/oracle-enhanced-3580c7a47d28/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1326:in `log'
    from /***/.bundler/ruby/1.9.1/oracle-enhanced-3580c7a47d28/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1280:in `select'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:56:in `select_all'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/base.rb:473:in `find_by_sql'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/relation.rb:64:in `to_a'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/activerecord/lib/active_record/relation.rb:359:in `inspect'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/railties/lib/rails/commands/console.rb:44:in `start'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/railties/lib/rails/commands/console.rb:8:in `start'
    from /***/.bundler/ruby/1.9.1/rails-9ffb07434e20/railties/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'irb(main):007:0> exit

I'll see if I can reproduce the issue without context to the app I'm working on.

dbernheisel commented 8 years ago

I was able to confirm that behavior is only with Oracle 12c and not with Oracle 11g.

dbernheisel commented 8 years ago

With some additional testing using OCI8 instead of going through the ActiveRecord adapter, I could see that it's not an oci8 issue. I'm using release14 of the oracle-enhanced adapter.

areman commented 8 years ago

strange. I can't belive. you think it's a oracle-enhanced problem? Maybe the oracle-enhanced-adapter sets some special session parameters.

dbernheisel commented 8 years ago

Dropping straight to ruby-oci8 didn't have a problem with the query. Using the oracle-enhanced adapter introduces the issue.

Looks like the oracle-enhanced-adapter team fixed a bug in their adapter in a later version. I only encountered it when using Release14 (latest for Ruby 1.9.3). I spiked a new project using a later release of the adapter and the same database and didn't encounter the issue.

The problem seems rooted in how the adapter handles floats versus integers.

So, what I guess this means is that I backport fixes to Release14 of the adapter, or I convince the client to upgrade my app's Ruby/Rails versions so I can upgrade the adapter.

areman commented 8 years ago

@dbernheisel Thank you for the information !! I'll try a newer version.