 |
Forums |
Admin Start New Thread
By: Zach Pratt
RE: issue with ibm_db gem and db2 on z/OS [ reply ] 2011-07-25 20:39
|
With the help of IBM, we finally found the solution to the problem. The primary cause was that we had the DESCSTAT zparm set to "NO" when we needed it to be set to "YES."
We performed the following to fix the issue:
Updated the DESCSTAT zparm on DBD1 to "YES"
Ran DSNTIJSG
Ran DSNTIJMS
The DSNTIJSG and DSNTIJMS jobs had to be ran in order to properly rebind a number of stored procedures that were affected by the zparm change.
Thanks for the help!
Zach
|
By: Zach Pratt
RE: issue with ibm_db gem and db2 on z/OS [ reply ] 2011-07-07 18:32
|
|
Our PMR has been updated to request that I run the bit of ruby code that you have posted. I'll respond to the PMR and then we can update this post with the solution if we find one. I do have access to both a z/OS and LUW instance of DB2.
|
By: Praveen Devarao
RE: issue with ibm_db gem and db2 on z/OS [ reply ] 2011-07-07 18:11
|
Hi Zach,
I will need CLI trace of the sample ruby script below when run against your database
#----------------------------------------
require 'ibm_db'
conn = IBM_DB.connect 'database','user','password'
stmt = IBM_DB.columns conn, nil, 'SCHEMA','TABLENAME' #Note the names should be in caps
IBM_DB.fetch_assoc stmt
IBM_DB.close conn
#----------------------------------------
The traces would help us further diagnose the problem.
I see that you have also opened a PMR for this issue (am I correct?). I have asked for CLI traces via the PMR too (the PMR team would come to you soon.)
Thanks
Praveen
|
By: Zach Pratt
issue with ibm_db gem and db2 on z/OS [ reply ] 2011-07-07 16:12
|
We're running version 8 of db2 for z/OS. The version string returned from db2 is 8.1.5. We're also using version 2.5.6 of the gem. Our problem appears to be in the active record adapter and what it expects to be returned from the driver. When querying a table using the where method of activerecord, we get the following stack trace:
RuntimeError: An unexpected error occurred during retrieval of column metadata: undefined method `downcase' for nil:NilClass
from /usr/lib64/ruby/gems/1.8/gems/ibm_db-2.5.6/lib/active_record/connection_adapters/ibm_db_adapter.rb:1569:in `columns'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/base.rb:679:in `columns'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/base.rb:692:in `column_names'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/base.rb:1665:in `inspect'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.0.4/lib/active_record/relation.rb:356:in `inspect'
from /usr/lib64/ruby/1.8/irb.rb:302:in `output_value'
from /usr/lib64/ruby/1.8/irb.rb:151:in `eval_input'
from /usr/lib64/ruby/1.8/irb.rb:263:in `signal_status'
from /usr/lib64/ruby/1.8/irb.rb:147:in `eval_input'
from /usr/lib64/ruby/1.8/irb.rb:146:in `eval_input'
from /usr/lib64/ruby/1.8/irb.rb:70:in `start'
from /usr/lib64/ruby/1.8/irb.rb:69:in `catch'
from /usr/lib64/ruby/1.8/irb.rb:69:in `start'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/commands/console.rb:44:in `start'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/commands/console.rb:8:in `start'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/commands.rb:23
from script/rails:6:in `require'
I have tested this with rails 3.0.4, 3.0.7 and 3.0.9 and the problem is the same with each.
The problem appears to be on line 1522 in the ibm_db_adapter.rb where it's calling the fetch_assoc method of the IBM_DB class. The adapter expects an associative array to be returned with keys like "column_name" , however, the keys that are returned are actually numerical.
For example, we have a table named PROSPECTIVE_STUDENT which we have mapped to an activerecord model named ProspectiveStudent. The primary key of the table is student_id and when we make the following method call:
ProspectiveStudent.where(:student_id => '777777777')
The result of IBM_DB.fetch_assoc(stmt) is:
{"11"=>0, "6"=>"CHAR", "12"=>"", "7"=>9, "13"=>nil, "8"=>9, "14"=>1, "9"=>nil, "15"=>nil, "16"=>9, "17"=>1, "1"=>nil, "18"=>"NO", "2"=>"STU", "3"=>"PROSPECTIVE_STUDENT", "10"=>nil, "4"=>"STUDENT_ID", "5"=>1}
Any ideas?
Thanks in advance.
|
|
 |