 |
Forums |
Admin Start New Thread
By: David Adler
RE: Invalid CLI option error [ reply ] 2007-11-20 17:34
|
Hi Alex, thanks for your help - I finally got it working.
I did have to add the host and port parameters to the database.yml file in order to get it to work.
The error in the CLI trace was as you suggested.
|
By: Alex Pitigoi
RE: Invalid CLI option error [ reply ] 2007-11-20 14:17
|
Hi David,
As mentioned in some previous threads, one needs to just place clidriver/bin in the path, and also ensure LD_LIBRARY_PATH points to clidriver/lib (on Unix and Linux) in order to setup the DB2 CLI Driver downloaded.
A quick search on the on-line DB2 Info Center shows some more details (including configuration, deployment, troubleshooting):
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.apdv.cli.doc/doc/c0023378.htm
I would recommend you to just run the following to setup a test environment for your DB2 on Rails client using the DB2 CLI driver directly:
C:\>set PATH=D:\clidriver-9.5.0\bin;%PATH%
C:\>db2level
DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09012" with level identifier "01030107".
Informational tokens are "DB2 v9.1.200.98", "s070210", "WR21380", and Fix Pack "2".
Product is installed at "D:\clidriver" with DB2 Copy Name "IBM DB2 Driver for ODBC and CLI".
C:\>irb
irb(main):001:0> require 'mswin32/ibm_db'
=> true
irb(main):002:0> conn = IBM_DB::connect 'DRIVER={IBM DB2 ODBC DRIVER};DATABASE=railsdb;HOSTNAME=host.or.ipaddres;PORT=50000;PROTOCOL=TCPIP;UID=userid;PWD=secret;', '', ''
=> #<IBM_DB::Connection:0x2f3521c>
irb(main):003:0> stmt = IBM_DB::exec conn, 'select schemaname from syscat.schemata'
=> #<IBM_DB::Statement:0x2f317d4>
irb(main):004:0> while schemas = IBM_DB::fetch_assoc(stmt)
irb(main):005:1> p schemas
irb(main):006:1> end
As for taking a trace, please consult DB2 Info Center docs on-line which can be found searching for "enable CLI trace":
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.pd.doc/doc/c0020795.htm
For DB2 CLI trace while using DB2 Driver for CLI and ODBC you just need to place db2cli.ini inside clidriver/cfg, but make sure there's no other db2cli.ini copy already in clidriver/ path (it seems to have precedence).
I hope this clarifies and helps you until we straighten out the current issues with 3 different defects on 0.8.0 (Vista crashes), 0.8.5 (CLI regression on connection attributes), 0.9.0 (VC80 compatibility issues).
P.S.
The CLI trace for IBM-0.8.0 while using DB2 CLI 9.5 is liekly to look like this (due to "Option=Unknown value 116"):
SQLSetConnectAttr( hDbc=0:1, fOption=Unknown value 116, pvParam=&00000001, iStrLen=-6 )
SQLSetConnectAttr( )
SQLGetDiagRec( fHandleType=SQL_HANDLE_DBC, hHandle=0:1, iRecNumber=1, pszSqlState=&02403a8c, pfNativeError=&02403ea0, pszErrorMsg=&02403a94, cbErrorMsgMax=1025, pcbErrorMsg=&024042b4 )
SQLGetDiagRec( pszSqlState="HY092", pfNativeError=-99999, pszErrorMsg="[IBM][CLI Driver] CLI0133E Option type out of range. SQLSTATE=HY092", pcbErrorMsg=68 )
|
By: David Adler
RE: Invalid CLI option error [ reply ] 2007-11-20 12:35
|
I hate to seem dense, but what does one do with the CLI driver after downloading and unzipping it?
The readme file only has the license terms.
I modified ibm_db_adapter.rb with the following to log the connection options before the connect is attempted:
conn_options.each do |key, value|
logger.info("#{Time.now} conn_options: key: #{key} ; value: #{value}")
end
This was the output in the log above the failing stack trace:
Tue Nov 20 07:23:18 -0800 2007 conn_options: key: 3271982 ; value: 1
Still no output in the CLI trace. The following is in db2cli.ini:
[common]
trace=1
traceflush=1
tracefilename=d:\temp\ruby2.trc
Things have moved around in V9.5 so I put db2cli.ini in both
d:\sqllib
and
c:\Documents and Settings\All Users\Application Data\IBM\DB2COPY1
|
By: Alex Pitigoi
RE: Invalid CLI option error [ reply ] 2007-11-20 02:50
|
Hi David,
You mentioned DB2 9.5 and I assume you are talking about both client and server on Win32. Given you are seeing error CLI0133E, then it should be possible to capture CLI trace that would likely show which input param is out of range (i.e. Option=Unknown value 2586).
This is a known regression in DB2 CLI 9.5 and 9.1.3 which is being fixed by IBM_DB-0.9.0 and also DB2 CLI 9.5 FP1.
Now, I know this particular IBM_DB-0.9.0 isn't going to run very well on win32 with your previous issues regarding VC80 runtime incompatibility on Windows, and we are yet to upload the IBM_DB-0.9.1 fix. At this time I can only recommend you to use the 9.1.2 DB2 Driver for ODBC and CLI (available on-line see link below) with IBM_DB-0.8.0 before the right fix is available on RubyForge. I just think this CLI 9.1.2 would be a much easier download and setup and would not impact your current DB2 9.5 server already installed.
Reference:
ftp://ftp.software.ibm.com/ps/products/db2/fixes2/english-us/db2_v91/clidriver/fp2/v9fp2_win_db2driver_for_odbc_cli.zip
|
By: David Adler
Invalid CLI option error [ reply ] 2007-11-19 18:45
|
I just tried moving one of my applications to a new machine with a new install of Ruby, rails, ibm_db and DB2 V9.5.
When I try to run my application I get the error and trace below. Turning on the CLI trace didn't produce any output.
RuntimeError (Failed to connect to the [ezmap] due to: [IBM][CLI Driver] CLI0133E Option type out of range. SQLSTATE=HY092 SQLCODE=-99999):
d:/ruby/lib/ruby/gems/1.8/gems/ibm_db-0.8.0-mswin32/lib/active_record/connection_adapters/ibm_db_adapter.rb:159:in `ibm_db_connection'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `send'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `connection_without_query_cache='
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/query_cache.rb:54:in `connection='
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:230:in `retrieve_connection'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:427:in `find_by_sql'
D:/dwacode/rails/EZMap2/app/controllers/bank_controller.rb:33:in `xmlCommon'
D:/dwacode/rails/EZMap2/app/controllers/bank_controller.rb:16:in `asGeoRSS'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:1101:in `send'
|
|
 |