Giter VIP home page Giter VIP logo

ruby-ibmdb's Introduction

ruby-ibmdb

Rails Adapter/Ruby Driver for IBM Data Servers: {DB2 on Linux/Unix/Windows, DB2 on zOS, DB2 on IBMi, IBM Informix (IDS)}

ibm_db gem version 5.5.0

Requirements:
 Ruby should be installed(Ruby version should be >=2.5.x and <= 3.2.x)
 For developing rails appications Rails should be 7.1.x

 Note: x86 version of ruby can be downloaded from https://rubyinstaller.org/downloads/archives/

Installing the IBM_DB adapter and driver

Issue the following command to install the ibm_db gem

gem install ibm_db

For Windows please set the below variable:-

set RUBY_DLL_PATH=path\to\clidriver\bin

Contacts

For any issues or help: https://github.com/ibmdb/ruby-ibmdb/issues

Local Development

To easily test changes to the ibm_db gem locally without building a gem package, add to your Rails Gemfile:

gem 'ibm_db', path: "/path/to/ruby-ibmdb/IBM_DB_Adapter/ibm_db"

Then build the ibm_db.so library:

$ cd /path/to/ruby-ibmdb/IBM_DB_Adapter/ibm_db/ext"
$ ruby extconf.rb
$ make

Then bundle install in your rails app:

$ bundle install
...
Using ibm_db 4.0.0 from source at `ruby-ibmdb/IBM_DB_Adapter/ibm_db`

License

Copyright (c) 2006 - 2017 IBM Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributing

See CONTRIBUTING

The developer sign-off should include the reference to the DCO in remarks(example below):
DCO 1.1 Signed-off-by: Random J Developer <[email protected]>

ruby-ibmdb's People

Contributors

akhilravuri1 avatar amukherjee28 avatar arvindgu avatar backbone81 avatar bimalkjha avatar calh avatar hajee avatar mariobriggs avatar praveen-db2 avatar praveend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-ibmdb's Issues

error in IRB when requiring gem

I have attempted to follow the applicable directions for installation and testing of the ibm_db gem. When I open IRB and require the gem on my windows pc, I get the following errors:

irb(main):001:0> require 'mswin32/ibm_db'
Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
. - connect(2) for "public.dhe.ibm.com" port 80
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:879:in initialize' from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:879:inopen'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:879:in block in connect' from C:/Ruby22/lib/ruby/2.2.0/timeout.rb:73:intimeout'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:878:in connect' from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:863:indo_start'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:852:in start' from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:1375:inrequest'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86-mingw32/lib/mswin32/ibm_db.rb:24:in downloadCLIPackage' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86-mingw32/lib/mswin32/ibm_db.rb:69:in<top (required)>'
from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in require' from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:inrescue in require'
from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in require' from (irb):1 from C:/Ruby22/bin/irb:11:in

'

Is there a config file that I don't know about that needs to be updated? Why is the gem attempting to connect to anything just when requiring?

Thanks.

Error while installing ibm_db gem:- unknown option: -R$ORIGIN/clidriver/lib

On Mac El Capitan 10.11.2 version, bundle install fails when installing ibm_db gem.
I was able to install the gem manually using the command:

gem install ibm_db (2.6.1 universal-darwin-14)

But when I do a bundle install it fails with below error.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/ myamun/.rvm/rubies/ruby-2.0.0-p598/bin/ruby -r ./siteconf20151228-798-13gznvv.rb extconf.rb
Detected 64-bit Ruby

creating gil_release_version
creating unicode_support_version
checking for SQLConnect() in -ldb2... yes
checking for gil_release_version... yes
checking for unicode_support_version... yes
creating Makefile
....
linking shared-object ibm_db.bundle
ld: unknown option: -R$ORIGIN/clidriver/lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ibm_db.bundle] Error 1

make failed, exit code 2 

Is there a way I can provide platform in my Gemfile to replicate the command that was run manually or is there something else that I would have to do?

Ruby 2.2.0: Error when trying to use ibm_db on Mac OS X

We are currently developing a rails application and are trying to get the ibm_db gem running on ruby 2.2.0. The ibm_db gem was installed successfully and we've patched #15. We use a Mac OS X (yosemite) system as development/testing machine.

We are facing the following error message as we load the page of our rails application:

dyld: lazy symbol binding failed: Symbol not found: _rb_thread_blocking_region

  Referenced from: /path/to/.rvm/gems/ruby-2.2.0/gems/ibm_db-2.5.18-x86_64-darwin-14/lib/linux/rb20x/ibm_db.bundle

  Expected in: flat namespace

We looked into that and found several threads with kind of the same issue. The problem is that rb_thread_blocking_region is no longer supported in ruby 2.2 (see phusion/passenger#1314 and https://github.com/ruby/ruby/blob/1c87fee3166c5208e92f1b7779507dd52c3087e1/NEWS) and has been removed.

rb_thread_blocking_region

Was removed and replaced by:

rb_thread_call_without_gvl

We will try to fix this in the ibm_db.c and I will edit this post as soon as I have more insight.

May it help us to change this function call in ibm_db.c and compile the ibm_db gem by hand?

Best,
Bug

Library not loaded: /Users/mario/sqllib/lib64/libdb2.dylib (LoadError)

I'm getting the error below with ibm_db 2.5.26 on Mac. I think the issue may be that "/Users/mario/" is hardcoded somewhere. There is no user named Mario on my system.

/Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/ibm_db-2.5.26-universal-darwin-14/lib/ibm_db.rb:5:in `require': dlopen(/Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/ibm_db-2.5.26-universal-darwin-14/lib/linux/rb19x/ibm_db.bundle, 9): Library not loaded: /Users/mario/sqllib/lib64/libdb2.dylib (LoadError)
  Referenced from: /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/ibm_db-2.5.26-universal-darwin-14/lib/linux/rb19x/ibm_db.bundle
  Reason: image not found - /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/ibm_db-2.5.26-universal-darwin-14/lib/linux/rb19x/ibm_db.bundle
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/ibm_db-2.5.26-universal-darwin-14/lib/ibm_db.rb:5:in `<top (required)>'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
    from /Users/leonsp/Projects/IMCloudAPI/config/application.rb:7:in `<top (required)>'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.1.12/lib/rails/commands.rb:21:in `require'
    from /Users/leonsp/.rvm/gems/ruby-1.9.3-p551/gems/railties-3.1.12/lib/rails/commands.rb:21:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Invalid foreign key ON UPDATE action specified in schema.rb

In our Rails 4.2 app, after foreign key support was added to ibm-db (in our case on ibm-db 3.0.1), running rake db:migrate adds foreign key definitions to schema.rb, as expected. However, for our schema, it adds the option on_update: :cascade, which is not a legal ON UPDATE action.

add_foreign_key "AUDIT_DETAILS", "AUDITS", column: "AUDIT_ID", primary_key: "ID", name: "FK_AUDDTL_ID", on_update: :cascade, on_delete: :restrict

What follows is the relevant portion of our DDL that defines this foreign key. Notice ON DELETE CASCADE and ON UPDATE RESTRICT.

ALTER TABLE "MARKETING"."AUDIT_DETAILS"
        ADD CONSTRAINT "FK_AUDDTL_ID" FOREIGN KEY
                ("AUDIT_ID")
        REFERENCES "MARKETING"."AUDITS"
                ("ID")
        ON DELETE CASCADE
        ON UPDATE RESTRICT
        ENFORCED
        ENABLE QUERY OPTIMIZATION;

Naturally, when we try to load this new schema.rb, DB2 tells us that ON UPDATE CASCADE is indeed illegal.

ActiveRecord::StatementInvalid: RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N  An unexpected token "CASCADE" was found following "ON UPDATE".  Expected tokens may include:  "RESTRICT, NO ACTION".  SQLSTATE=42601 SQLCODE=-104: ALTER TABLE AUDIT_DETAILS ADD CONSTRAINT FK_AUDDTL_ID
FOREIGN KEY (AUDIT_ID)
  REFERENCES AUDITS (ID)
 ON DELETE RESTRICT ON UPDATE CASCADE

I can work with you to provide any other information you need to reproduce or fix this bug. Thanks!

Accessing DB2 server on OSX throws "Connection failed" error

Running ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-darwin14.1.0] and ibm_db (2.5.26 universal-darwin-14).
Attempting to read from DB2 database throws error:
ERROR - DATA: eval failed to return, and generated an exception: Failed to connect to [mlq10] due to: uncaught throw :"Connection failed: [IBM][CLI Driver] SQL10007N Message \"0\" could not be retrieved. Reason code: \"3\". SQLCODE=-1390" (RuntimeError).
Any suggestions?

gem 3.0.0 fails to install on ubuntu 15.04

Installed ubuntu-15.04, ruby-dev-2.1.
The gem fails to build due to a format-security warning being treated as an error (default hardening on recent ubuntu versions).
I tried various methods to overcome or eliminate the -Werror=format-security flag without success.
I'd welcome any suggestions as to how to workaround this issue.
In the interim, I'll try another distro :-)

user@linx:~$ sudo gem install -V ibm_db
GET https://api.rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://rubygems.global.ssl.fastly.net/latest_specs.4.8.gz
200 OK
HEAD https://api.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=ibm_db
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=activerecord
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=activemodel
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=activesupport
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=arel
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=builder
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=thread_safe
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=minitest
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=tzinfo
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=json
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=i18n
200 OK
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/CHANGES
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/LICENSE
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/MANIFEST
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ParameterizedQueries README
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/README
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/Makefile.nt32
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/Makefile.nt32.191
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/extconf.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/extconf_MacOS.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/ibm_db.c
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/ruby_ibm_db.h
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/ruby_ibm_db_cli.c
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/ext/ruby_ibm_db_cli.h
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/init.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/lib/IBM_DB.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/lib/active_record/connection_adapters/ibm_db_adapter.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/lib/active_record/connection_adapters/ibm_db_pstmt.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/lib/active_record/connection_adapters/ibmdb_adapter.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/lib/active_record/vendor/db2-i5-zOS.yaml
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/adapter_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/associations/belongs_to_associations_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/associations/cascaded_eager_loading_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/associations/has_and_belongs_to_many_associations_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/associations/join_model_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/attribute_methods_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/base_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/calculations_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/migration_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/persistence_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/query_cache_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/relations_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/schema_dumper_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/transaction_callbacks_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/validations/uniqueness_validation_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/cases/xml_serialization_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/config.yml
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/connections/native_ibm_db/connection.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/ibm_db_test.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/models/warehouse_thing.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/schema/i5/ibm_db_specific_schema.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/schema/ids/ibm_db_specific_schema.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/schema/luw/ibm_db_specific_schema.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/schema/schema.rb
/var/lib/gems/2.1.0/gems/ibm_db-3.0.0/test/schema/zOS/ibm_db_specific_schema.rb
Building native extensions.  This could take a while...
/usr/bin/ruby2.1 extconf.rb
Detected 64-bit Ruby

Detected platform - linux x86 64
extconf.rb:68: warning: already initialized constant DOWNLOADLINK
extconf.rb:44: warning: previous definition of DOWNLOADLINK was here
Environment variable IBM_DB_HOME is not set. Downloading and setting up the DB2 client driver
extconf.rb:156: warning: already initialized constant IBM_DB_HOME
extconf.rb:20: warning: previous definition of IBM_DB_HOME was here
extconf.rb:158: warning: already initialized constant IBM_DB_INCLUDE
extconf.rb:143: warning: previous definition of IBM_DB_INCLUDE was here
extconf.rb:159: warning: already initialized constant IBM_DB_LIB
extconf.rb:144: warning: previous definition of IBM_DB_LIB was here
creating gil_release_version
creating unicode_support_version
checking for SQLConnect() in -ldb2... yes
checking for gil_release_version... yes
checking for unicode_support_version... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling ibm_db.c
ibm_db.c:106:0: warning: "STRCASECMP" redefined
 #define STRCASECMP strcasecmp
 ^
In file included from /usr/include/ruby-2.1.0/ruby.h:33:0,
                 from ibm_db.c:21:
/usr/include/ruby-2.1.0/ruby/ruby.h:1783:0: note: this is the location of the previous definition
 #define STRCASECMP(s1, s2) (st_locale_insensitive_strcasecmp((s1), (s2)))
 ^
ibm_db.c: In function ‘_ruby_ibm_db_connect_helper2’:
ibm_db.c:2360:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         handleAttr_args->valuePtr    =  (SQLPOINTER)(enable_numeric_literals);
                                         ^
ibm_db.c: In function ‘_ruby_ibm_db_connect_helper’:
ibm_db.c:2538:26: warning: comparison between pointer and integer
   if(helper_args-> entry == NULL)
                          ^
ibm_db.c: In function ‘ibm_db_autocommit’:
ibm_db.c:3328:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         handleAttr_args->valuePtr = (SQLPOINTER)autocommit;
                                     ^
In file included from /usr/include/ruby-2.1.0/ruby.h:33:0,
                 from ibm_db.c:21:
ibm_db.c: In function ‘_ruby_ibm_db_do_prepare’:
/usr/include/ruby-2.1.0/ruby/ruby.h:1121:30: error: format not a string literal and no format arguments [-Werror=format-security]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:848:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
ibm_db.c:5676:18: note: in expansion of macro ‘RSTRING_PTR’
         rb_warn( RSTRING_PTR(error) );
                  ^
ibm_db.c: In function ‘ibm_db_exec’:
/usr/include/ruby-2.1.0/ruby/ruby.h:1121:30: error: format not a string literal and no format arguments [-Werror=format-security]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:848:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
ibm_db.c:5816:20: note: in expansion of macro ‘RSTRING_PTR’
           rb_warn( RSTRING_PTR(error) );
                    ^
ibm_db.c: In function ‘ibm_db_execute’:
/usr/include/ruby-2.1.0/ruby/ruby.h:1121:30: error: format not a string literal and no format arguments [-Werror=format-security]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:848:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
ibm_db.c:7027:16: note: in expansion of macro ‘RSTRING_PTR’
       rb_warn( RSTRING_PTR(error) );
                ^
ibm_db.c: In function ‘ibm_db_result’:
/usr/include/ruby-2.1.0/ruby/ruby.h:1121:30: error: format not a string literal and no format arguments [-Werror=format-security]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:848:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
ibm_db.c:9284:14: note: in expansion of macro ‘RSTRING_PTR’
     rb_warn( RSTRING_PTR(error) );
              ^
ibm_db.c: In function ‘ibm_db_set_option’:
/usr/include/ruby-2.1.0/ruby/ruby.h:1121:30: error: format not a string literal and no format arguments [-Werror=format-security]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:848:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
ibm_db.c:10574:20: note: in expansion of macro ‘RSTRING_PTR’
           rb_warn( RSTRING_PTR(error) );
                    ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1121:30: error: format not a string literal and no format arguments [-Werror=format-security]
 #define RSTRING(obj) (R_CAST(RString)(obj))
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
 #define R_CAST(st)   (struct st*)
                              ^
/usr/include/ruby-2.1.0/ruby/ruby.h:848:6: note: in expansion of macro ‘RSTRING’
      RSTRING(str)->as.heap.ptr)
      ^
ibm_db.c:10584:20: note: in expansion of macro ‘RSTRING_PTR’
           rb_warn( RSTRING_PTR(error) );
                    ^
cc1: some warnings being treated as errors
Makefile:224: recipe for target 'ibm_db.o' failed
make: *** [ibm_db.o] Error 1
ERROR:  Error installing ibm_db:
    ERROR: Failed to build gem native extension.

    Building has failed. See above output for more information on the failure.
make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.1.0/gems/ibm_db-3.0.0 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/ibm_db-3.0.0/gem_make.out
user@linx:~$ 

Load Error : ibm_db-2.5.26-x86-mingw32/lib/mswin32/rb19x/ibm_db.so (Windows 7 - ibm_db-2.5.26-x86-mingw32 )

Environment:
$ gem environment
RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.28
  • RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [i386-mingw32]
  • INSTALLATION DIRECTORY: c:/ruby-1.9.3/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE: c:/ruby-1.9.3/bin/ruby.exe
  • EXECUTABLE DIRECTORY: c:/ruby-1.9.3/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-mingw32
  • GEM PATHS:
    • c:/ruby-1.9.3/lib/ruby/gems/1.9.1
    • c:/Users/1472947/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

Error details:
$ ruby db2test.rb
c:/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in require': 193: %1 is not a valid Win32 application. - c:/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.26-x86-mingw32/lib/mswin32/rb19x/ibm_db.so (LoadError) from c:/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:inrescue in require'
from c:/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in require' from c:/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.26-x86-mingw32/lib/mswin32/ibm_db.rb:2:in<top (required)>'
from c:/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in require' from c:/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:inrescue in require'
from c:/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in require' from db2test.rb:2:in

Code

require 'rubygems'
require 'mswin32/ibm_db'

conn = IBM_DB.connect("DRIVER={IBM DB2 ODBC DRIVER};DATABASE=RMALL;
HOSTNAME=ip;PORT=50000;PROTOCOL=TCPIP;
UID=usr;PWD=pass;", "", "")
if conn
puts "We're connected!"
IBM_DB.close(conn)
else
puts "There was an error in the connection: #{IBM_DB.conn_errormsg}"
end

Does it support 'binary' column type?

Hi,

Should we expect this gem support the binary column type? ActiveRecord generally supports it but we wonder if this gem implementation also supports it. Thanks!

Calvin

rake db:drop/db:create issue

Hello again,

The inability to perform 'rake db:drop' and 'rake db:create' is actually a rather annoying one for those of us who use RSPEC (or other testing frameworks) as we have to manually go in and drop the test table, then create it again, then run 'rake db:schema:load' every single time.

Is there any chance this issue may be addressed?

Thanks,
~ Ryan

update_attributes sets all clobs to '<ibm>@@@IBMTEXT@@@</ibm>'

Regardless of what value you pass in for a clob, update_attributes will set the value to <ibm>@@@IBMTEXT@@@</ibm> in the database.

For example:

mm = MyModel.find(141)
mm.update_attributes(description: "Foo bar baz")
SQL (0.7ms) UPDATE my_models SET description = '@@@IBMTEXT@@@', updated_at = '2016-01-04 18:56:55.047075' WHERE my_models.id = 141
=> true

update_attributes! has the same behaviour, as does modifying the attribute and then calling save.

I'm using ibm_db 3.0.0 on Rails 4.2.4

Extract database driver from ActiveRecord adapter

Would it be difficult to create a separate gem that provides the IBM_DB library separate from the ibm_db/active_record adapter? I think that would be valuable in our use-case since we're using the Sequel gem as our adapter instead of ActiveRecord.

Missing method 'columns'

Hello, I just updated my version of rails to 3.2.17 from 3.2.13 and on my production server I now run into the following error when using the method pluck. Im running ibm_db v 2.5.18.

undefined method `columns' for #<IBM_DB::Statement:0x0000000569b2e8>

The code that it run is

Candidature.pluck(:name)...

Any clues on what might be causing this?

And with the following framework trace

vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/relation/calculations.rb:185:in `pluck'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:368:in `call'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:368:in `block in capture_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:608:in `with_haml_buffer'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:364:in `capture_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:45:in `capture_with_haml'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/record_tag_helper.rb:104:in `content_tag_for_single_record'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/record_tag_helper.rb:89:in `content_tag_for'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:145:in `block in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:125:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:143:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:351:in `block in collection_with_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:348:in `each'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:348:in `collection_with_template'
vendor/bundle/ruby/1.9.1/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:75:in `render_collection_with_multi_fetch_cache'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:234:in `block in render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:233:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:41:in `render_partial'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:15:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/rendering_helper.rb:24:in `render'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:89:in `non_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:368:in `call'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:368:in `block in capture_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:608:in `with_haml_buffer'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:364:in `capture_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:45:in `capture_with_haml'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/record_tag_helper.rb:104:in `content_tag_for_single_record'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/record_tag_helper.rb:89:in `content_tag_for'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:145:in `block in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:125:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:143:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:351:in `block in collection_with_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:348:in `each'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:348:in `collection_with_template'
vendor/bundle/ruby/1.9.1/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:75:in `render_collection_with_multi_fetch_cache'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:234:in `block in render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:233:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:41:in `render_partial'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/rendering_helper.rb:27:in `render'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:89:in `non_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:368:in `call'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:368:in `block in capture_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:608:in `with_haml_buffer'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:364:in `capture_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:45:in `capture_with_haml'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/record_tag_helper.rb:104:in `content_tag_for_single_record'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/record_tag_helper.rb:89:in `content_tag_for'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:145:in `block in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:125:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:143:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:351:in `block in collection_with_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:348:in `each'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:348:in `collection_with_template'
vendor/bundle/ruby/1.9.1/gems/multi_fetch_fragments-0.0.17/lib/multi_fetch_fragments.rb:57:in `render_collection_with_multi_fetch_cache'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:234:in `block in render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/partial_renderer.rb:233:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:41:in `render_partial'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:15:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/helpers/rendering_helper.rb:24:in `render'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers.rb:89:in `non_haml'
vendor/bundle/ruby/1.9.1/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:145:in `block in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:125:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/template.rb:143:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/template_renderer.rb:18:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:36:in `render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/renderer/renderer.rb:17:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/rendering.rb:110:in `_render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/streaming.rb:225:in `_render_template'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/rendering.rb:103:in `render_to_body'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/rendering.rb:88:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/rendering.rb:16:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/benchmark.rb:5:in `ms'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/instrumentation.rb:39:in `render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/responder.rb:232:in `default_render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/responder.rb:160:in `to_html'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/responder.rb:153:in `respond'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/responder.rb:146:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/mime_responds.rb:239:in `respond_with'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/base.rb:167:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/rendering.rb:10:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:491:in `_run__453186150088593794__process_action__4550856987894487656__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/callbacks.rb:17:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/rescue.rb:29:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/base.rb:121:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/abstract_controller/rendering.rb:45:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal.rb:203:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_controller/metal.rb:246:in `block in action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/routing/route_set.rb:73:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/routing/route_set.rb:36:in `call'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/routing/route_set.rb:608:in `call'
vendor/bundle/ruby/1.9.1/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
vendor/bundle/ruby/1.9.1/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
vendor/bundle/ruby/1.9.1/gems/omniauth-1.2.2/lib/omniauth/builder.rb:59:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/head.rb:14:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/flash.rb:242:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/cookies.rb:341:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/query_cache.rb:64:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:405:in `_run__3816171830721382793__call__2590470846085509166__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_dispatch/middleware/static.rb:63:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-ssl-1.3.4/lib/rack/ssl.rb:27:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/engine.rb:484:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/application.rb:231:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/controllers/controller.rb:87:in `start'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
vendor/bundle/ruby/1.9.1/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
vendor/bundle/ruby/1.9.1/bin/thin:23:in `<main>'
´´´

Odd behavior

Hello:

I am seeing some odd, and unpredictable, behavior. Rarely, a query returns without issue. Sometimes, a query only returns a fraction of the known rows. Mostly, I receive this cryptic message:
uncaught throw :"Fetch Failure: ". This occurs whether I use fetch_array or fetch_assoc. Please advise. Thank you.

Windows Server 2008 R2 Enterprise (x64)
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
Rails 4.0.2
ibm_db (2.5.18 x86-mingw32, 2.5.17 x86-mingw32)

ibm_db_error

Foreign_key Error in rake db:rollback, ruby-ibmdb 2.6.1

Hi,
Rake db:rollback not work when we have migrations with add_foreign_key.

 class CreateLawyerOfficeAreas < ActiveRecord::Migration
  def change
    create_table :lawyer_office_areas do |t|
      t.references :lawyer_office, null: false, index: true
      t.references :province, null: false, index: true
      t.references :judicial_district, index: true
      t.timestamps
    end

    add_foreign_key :lawyer_office_areas, :lawyer_offices, on_delete: :cascade
    add_foreign_key :lawyer_office_areas, :provinces, on_delete: :cascade
    add_foreign_key :lawyer_office_areas, :judicial_districts, on_delete: :cascade

  end
end
user1000@5e0cee1c1941:~$ bundle exec rake db:migrate
== 20150721102932 CreateLawyerOfficeAreas: migrating ==========================
-- create_table(:lawyer_office_areas)
   -> 0.2923s
-- add_foreign_key(:lawyer_office_areas, :lawyer_offices, {:on_delete=>:cascade})
   -> 0.0110s
-- add_foreign_key(:lawyer_office_areas, :provinces, {:on_delete=>:cascade})
   -> 0.0142s
-- add_foreign_key(:lawyer_office_areas, :judicial_districts, {:on_delete=>:cascade})
   -> 0.0281s
== 20150721102932 CreateLawyerOfficeAreas: migrated (0.3464s) =================


user1000@5e0cee1c1941:~$ bundle exec rake db:rollback
== 20150721102932 CreateLawyerOfficeAreas: reverting ==========================
-- remove_foreign_key(:lawyer_office_areas, :judicial_districts)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Table 'lawyer_office_areas' has no foreign key on column 'judicial_district_id'/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:780:in `block in remove_foreign_key'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:774:in `fetch'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:774:in `remove_foreign_key'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:497:in `block in revert'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:496:in `each'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:496:in `revert'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:604:in `exec_migration'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:827:in `down'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:907:in `move'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:809:in `rollback'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:125:in `block (2 levels) in <top (required)>'
ArgumentError: Table 'lawyer_office_areas' has no foreign key on column 'judicial_district_id'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:780:in `block in remove_foreign_key'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:774:in `fetch'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:774:in `remove_foreign_key'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:497:in `block in revert'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:496:in `each'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:496:in `revert'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:604:in `exec_migration'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:827:in `down'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:907:in `move'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:809:in `rollback'
/ruby_gems/2.1/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:125:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:rollback
(See full trace by running task with --trace)

Unable to connect to remote DB2 instance on Mac OSX

Hello,

I'm having trouble requiring the ibm_db gem inside an irb session, or plain ruby file.

I'm running Mac OS 10.10.2, rbenv with ruby 2.0.0-p353. I've downloaded and extracted the odbc_cli distributable from IBM.

I was able to install the gem properly after setting the IBM_HOME_DB environment variable pointing to the extracted assembly.

From an irb session, when requiring the ibm_db gem, I get the following:

irb(main):001:0> require 'ibm_db'
LoadError: dlopen(/usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/ibm_db-2.5.18-x86_64-darwin-14/lib/linux/rb20x/ibm_db.bundle, 9): Library not loaded: /opt/IBM/db2/V10.1/lib64/libdb2.dylib
  Referenced from: /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/ibm_db-2.5.18-x86_64-darwin-14/lib/linux/rb20x/ibm_db.bundle
  Reason: image not found - /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/ibm_db-2.5.18-x86_64-darwin-14/lib/linux/rb20x/ibm_db.bundle
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:118:in `require'
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:118:in `rescue in require'
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:124:in `require'
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/ibm_db-2.5.18-x86_64-darwin-14/lib/ibm_db.rb:7:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:118:in `require'
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:118:in `rescue in require'
    from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:124:in `require'
    from (irb):1
    from /usr/local/opt/rbenv/versions/2.0.0-p353/bin/irb:12:in `<main>'

Can you provide any assistance?

3.0.0 fails to install on OS X

I've run into issues installing this gem on my machine (El Capitan). After reading through other issues, I've resolved a few issue, but still have more. Documentation would help!

  1. IBM_DB_HOME is not set.

After installing db2_v101_macos_expc & macos64_odbc_cli and setting IBM_DB_HOME to either(??) install location, I was able to get to the next issue.

  1. I guess installing the packages in part 1 wasn't the right move.
/opt/rubies/2.2.2/bin/ruby -r ./siteconf20160104-18336-8cphfx.rb extconf.rb
Detected 64-bit Ruby

Detected usage of IBM Data Server Driver package. Ensure you have downloaded 64-bit package of IBM_Data_Server_Driver and retry the 'gem install ibm_db' command

creating gil_release_version
creating unicode_support_version
checking for SQLConnect() in -ldb2... yes
checking for gil_release_version... yes
checking for unicode_support_version... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling ibm_db.c
ibm_db.c:106:9: warning: 'STRCASECMP' macro redefined [-Wmacro-redefined]
#define STRCASECMP strcasecmp
        ^
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:1801:9: note: previous definition is here
#define STRCASECMP(s1, s2) (st_locale_insensitive_strcasecmp((s1), (s2)))
        ^
ibm_db.c:698:12: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
                                return rb_thread_call_without_gvl(func, data1, ubf, data2);                        
                                       ^
ibm_db.c:2360:41: warning: cast to 'SQLPOINTER' (aka 'void *') from smaller integer type 'SQLINTEGER' (aka 'int') [-Wint-to-void-pointer-cast]
        handleAttr_args->valuePtr    =  (SQLPOINTER)(enable_numeric_literals);
                                        ^
ibm_db.c:2304:32: warning: 'memset' call operates on objects of type 'SQLWCHAR' (aka 'unsigned short') while the size is based on a different type 'SQLWCHAR *' (aka 'unsigned short *') [-Wsizeof-pointer-memaccess]
      memset(server, 0, sizeof(server));
             ~~~~~~            ^~~~~~
ibm_db.c:2304:32: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
      memset(server, 0, sizeof(server));
                               ^~~~~~
ibm_db.c:2433:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
ibm_db.c:2538:26: warning: comparison between pointer and integer ('VALUE' (aka 'unsigned long') and 'void *')
                if(helper_args-> entry == NULL)
                   ~~~~~~~~~~~~~~~~~~~ ^  ~~~~
ibm_db.c:3328:37: warning: cast to 'SQLPOINTER' (aka 'void *') from smaller integer type 'SQLINTEGER' (aka 'int') [-Wint-to-void-pointer-cast]
        handleAttr_args->valuePtr = (SQLPOINTER)autocommit;
                                    ^
ibm_db.c:5676:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        rb_warn( RSTRING_PTR(error) );
                 ^~~~~~~~~~~~~~~~~~
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:866:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c:5816:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
          rb_warn( RSTRING_PTR(error) );
                   ^~~~~~~~~~~~~~~~~~
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:866:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c:7027:16: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
      rb_warn( RSTRING_PTR(error) );
               ^~~~~~~~~~~~~~~~~~
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:866:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c:9284:14: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
    rb_warn( RSTRING_PTR(error) );
             ^~~~~~~~~~~~~~~~~~
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:866:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c:10574:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
          rb_warn( RSTRING_PTR(error) );
                   ^~~~~~~~~~~~~~~~~~
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:866:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c:10584:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
          rb_warn( RSTRING_PTR(error) );
                   ^~~~~~~~~~~~~~~~~~
/opt/rubies/2.2.2/include/ruby-2.2.0/ruby/ruby.h:866:5: note: expanded from macro 'RSTRING_PTR'
    (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c:11252:6: warning: comparison of address of 'connection' equal to a null pointer is always false [-Wtautological-pointer-compare]
        if(&connection == NULL)
            ^~~~~~~~~~    ~~~~
14 warnings generated.
compiling ruby_ibm_db_cli.c
linking shared-object ibm_db.bundle
ld: unknown option: -R$ORIGIN/clidriver/lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ibm_db.bundle] Error 1

make failed, exit code 2
  1. Can't find the installer for IBM Data Server Driver package

I can find a lot of links for Linux and Windows, but nothing for OS X. What's up? http://www-01.ibm.com/support/docview.wss?uid=swg21385217

CLA issue

CLA required bug number for IBM i fork of ibm_db.

Rails 4.2.4 Ruby 2.1.7 ibm_db-2.6.1-x86-mingw32 DB2 9.7.7

Hello,

I just started a new application with activeadmin gem and I get the below issue.
I cannot find the version of db2 request from drivers, could be this the problem or what else?

RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/AIX64] SQL0206N  "SYS_ROW_NUM" is not valid in the context where it is used.  SQLSTATE=42703
 SQLCODE=-206: SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( SELECT  COUNT(count_column) FROM (SELECT  1 AS count_column FROM users ) AS I) AS O WHERE sys_row_num BETWEEN 1 AND 30) subquery_for_count

some problem

some problem in some test case:

test1

#coding: utf-8
require "active_record"
require "active_record/connection_adapters/ibm_db_adapter"
require "logger"

ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.establish_connection(
  adapter: 'ibm_db', username: 'db2admin', password: 'db2admin', database: 'sample')

ActiveRecord::Base.connection.drop_table 'mytest2s' rescue nil

ActiveRecord::Base.connection.create_table 'mytest2s' do |t|
  t.string :msg
end

class Mytest2 < ActiveRecord::Base
end

values=['1234', 'abcd', "\u8f93\u5165"]

values.each do |vs|
  Mytest2.create(msg: vs)
  v1 = Mytest2.last
  v2 = Mytest2.find_by_sql(["select * from mytest2s where msg like ?", '%'+vs+'%'])
  p [vs, v1.msg == vs, v2.size, v2[0]]
end

return

["1234", true, 1, #<Mytest2 id: 1, msg: "1234">]
["abcd", true, 1, #<Mytest2 id: 2, msg: "abcd">]
["\u8F93\u5165", true, 0, nil]

line 3, insert and get last row is ok. but find_by_sql return nil


test2

#coding: utf-8
require "ibm_db"

db=IBM_DB.connect "sample", 'db2admin', 'db2admin'
IBM_DB.exec db, "drop table test1"
IBM_DB.exec db, "create table test1 (msg varchar(255) )"

['1234', 'abcd', "\u8f93\u5165"].each do |vs|
  IBM_DB.exec db, "insert into test1(msg) values('#{vs}') "
  ts=IBM_DB.exec db, "select * from test1 where msg like '#{vs}' "
  xx=IBM_DB.fetch_array(ts)
  p [xx[0], vs, xx[0]==vs]
end

IBM_DB.close db

return

["1234", "1234", true]
["abcd", "abcd", true]
["\u6748\u64B3\u53C6", "\u8F93\u5165", false]

line 3, query data is different to inserted data


test3

#coding: utf-8
require "ibm_db"

db=IBM_DB.connect "sample", 'db2admin', 'db2admin'
IBM_DB.exec db, "drop table test1"
IBM_DB.exec db, "create table test1 (msg varchar(255) )"

['1234', '3434', 'abcd', "\u8f93\u5165"].each do |vs|
  st = IBM_DB.prepare db, "insert into test1(msg) values(?) "
  IBM_DB.bind_param st, 1, vs #, IBM_DB::SQL_PARAM_INPUT, IBM_DB::SQL_CHAR
  IBM_DB.execute st

  st = IBM_DB.prepare db, "select * from test1 where msg like ? "
  IBM_DB.bind_param st, 1, vs #, IBM_DB::SQL_PARAM_INPUT, IBM_DB::SQL_CHAR
  IBM_DB.execute st

  xx=IBM_DB.fetch_array(st)
  if xx
    p [xx[0], vs, xx[0]==vs]
  else
    p false
  end 
end

IBM_DB.close db

return

["1234", "1234", true]
["3434", "3434", true]
eval:1:in `block in <main>': undefined local variable or method `abcd' for main:Object (NameError)
        from 111.rb:11:in `execute'
        from 111.rb:11:in `block in <main>'
        from 111.rb:8:in `each'
        from 111.rb:8:in `<main>'

prepare/bind_param/execute raise error


env

DB2 v9.7.500.4299
sample codepage is UTF-8
windows xp
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
ibm_db (2.5.18 x86-mingw32)

Compability with ISO-8859-1

Hi. I have a database that is all encoded with ISO-8859-1 and I'm using rails and having a problem with accentuation.

sql = "select * FROM users WHERE name='zé'"
 stmt = ActiveRecord::Base.connection.execute(sql)
 res = IBM_DB.fetch_row(stmt)

This code returns false even if there is a user named 'zé'.

Looking at the source code I didn´t find any reference for ISO-8859-1. Can you guys please help me with that?
I'm using
gem 'ibm_db', '2.5.11'
'rails', '3.2.17'

Thanks!

Error when using .uniq

Hi, I get the following error when calling uniq on a relation

RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL0134N  Improper use of a string column, host variable, constant, or function "DESCRIPTION".  SQLSTATE=42907 SQLCODE=-134: SELECT DISTINCT reports.* FROM reports 

The code that causes the error is

@reports = Report.uniq

The report table does have a description field which is of type text which might be causing this issue but I'm not sure.

Any thoughts?

Reason code = "2". SQLSTATE=42822 SQLCODE=-214

Hello all,

When applying pagination via the Kaminari gem (https://github.com/amatsuda/kaminari) the idm_db gem is adding "DISTINCT" to the query, which is causing the following error:

RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL0214N An expression in the ORDER BY clause in the following position, or starting with "SELLER_TYPES" in the "ORDER BY" clause is not valid. Reason code = "2". SQLSTATE=42822 SQLCODE=-214: SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM (SELECT DISTINCT sellers.id FROM sellers INNER JOIN seller_types ON seller_types.id = sellers.seller_type_id LEFT OUTER JOIN addresses ON addresses.addressable_id = sellers.id AND addresses.addressable_type = 'Seller' LEFT OUTER JOIN adjusters_sellers ON adjusters_sellers.seller_id = sellers.id LEFT OUTER JOIN adjusters ON adjusters.id = adjusters_sellers.adjuster_id LEFT OUTER JOIN contacts ON contacts.contactable_id = sellers.id AND contacts.contactable_type = 'Seller' LEFT OUTER JOIN seller_companies ON seller_companies.id = sellers.seller_company_id WHERE (sellers.country_id = 19) ORDER BY seller_types.id, sellers.id) AS I) AS O WHERE sys_row_num BETWEEN 1 AND 50

We ran the same query without the "DISTINCT" in the db2 console and received the expected results. For clarity sake here is the query we ran in db2 console:

SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM (SELECT sellers.id FROM sellers INNER JOIN seller_types ON seller_types.id = sellers.seller_type_id LEFT OUTER JOIN addresses ON addresses.addressable_id = sellers.id AND addresses.addressable_type = 'Seller' LEFT OUTER JOIN adjusters_sellers ON adjusters_sellers.seller_id = sellers.id LEFT OUTER JOIN adjusters ON adjusters.id = adjusters_sellers.adjuster_id LEFT OUTER JOIN contacts ON contacts.contactable_id = sellers.id AND contacts.contactable_type = 'Seller' LEFT OUTER JOIN seller_companies ON seller_companies.id = sellers.seller_company_id WHERE (sellers.country_id = 19) ORDER BY seller_types.id, sellers.id) AS I) AS O WHERE sys_row_num BETWEEN 1 AND 50

Is it possible for us to set up the gem, or perhaps our query, in such a way that the "DISTINCT" is not included in this statement?

Thanks for any help,
~ Ryan

Error trying to connect to Informix DB

I'm doing some initial testing trying to connect to an Informix DB through the rails console, and I have installed the ibm_db gem. Here's what I have in database.yml:

adapter: ibm_db
host: 192.168.111.170
port: 1526
username: someuser
password: secret
database: trangateway

However, I get the following when trying to look at one of the tables via the console:

RuntimeError: Failed to connect to [trangateway] due to: uncaught throw :"Connection failed: [IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "192.168.111.170". Communication function detecting the error: "recv". Protocol specific error code(s): "", "", "0". SQLSTATE=08001 SQLCODE=-30081"

All my database.yml credentials look good. On the Informix server I see the following error:

-408 invalid message type received

Any suggestions? Thanks!

Failed deploy to bluemix - cannot connect with database using ibm_db gem

hi - I am writing a RoR app with the following in my gemfile and unable to deploy properly to Bluemix.

gem 'ibm_db', '~> 2.5.18'

When I run bundle install I got the following notification:

Successfully installed ibm_db, the Ruby gem for IBM DB2/Informix. The Ruby gem
is licensed under the MIT License. The package also includes IBM ODBC and CLI
Driver from IBM, which could have been automatically downloaded as the Ruby gem
is installed on your system/device. The license agreement to the IBM driver is
available in the folder "$GEM_HOME/ibm_db-*/lib/clidriver/license". Check for
additional dependencies, which may come with their own license agreement(s). You
r use of the components of the package and dependencies constitutes your accepta
nce of their respective license agreements. If you do not accept the terms of a
ny license agreement(s), then delete the relevant component(s) from your system/
device.

My manifest.yml is as follows:

applications:

  • path: .
    memory: 512M
    instances: 1
    domain: mybluemix.net
    name: KnowYourBrand
    host: kyb
    command: bundle exec rake db:setup && bundle exec rails s -p $PORT
    disk_quota: 1024M
    services:

The ibm_db directory is saved locally under

C:\Ruby22\lib\ruby\gems\2.2.0\gems\ibm_db-2.5.27-x86-mingw32


Here is a clip of my server logs on Bluemix when the deploy fails...

[App/0]
err
/home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in block in require' 2015-12-02T12:12:17.223-0600 [App/0] err /home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:inrequire'
2015-12-02T12:12:17.223-0600
[App/0]
err
/home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in require' 2015-12-02T12:12:17.223-0600 [App/0] err /home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:ineach'
2015-12-02T12:12:17.223-0600
[App/0]
err
/home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in each' 2015-12-02T12:12:17.223-0600 [App/0] err /home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:inrequire'
2015-12-02T12:12:17.223-0600
[App/0]
err
/home/vcap/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
2015-12-02T12:12:17.223-0600
[App/0]
err
LoadError: libdb2.so.1: cannot open shared object file: No such file or directory - /home/vcap/app/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/ibm_db-2.5.27/ibm_db.so


Separately if I try to run the command ruby extconf.rb,

C:\Ruby22\lib\ruby\gems\2.2.0\gems\ibm_db-2.5.27-x86-mingw32\ext>ruby extconf.rb

I get the following:

Detected 32-bit Ruby

Environment variable IBM_DB_HOME is not set. Set it to your DB2/IBM_Data_Server_
Driver installation directory and retry gem install.

What seems to be the reason I cannot connect to the database? This has been an issue I have been unable to resolve for weeks and would love a quick resolution. Thanks so much!

Cannot establish connection from OS X to db2 on system i

@arvindgu Thanks for helping me out with #51! James and I worked on that for a while.

I'm having issues connecting to the database now. I expect I'll hit the license issue eventually, but for now, I can't connect. I've google this a bit, but what I've sounds seems pretty cryptic. Could you help me out?

Thanks!

RuntimeError: Failed to connect to [database] due to: uncaught throw :"Connection failed: [IBM][CLI Driver] SQL30081N  A communication error has been detected. Communication protocol being used: \"TCP/IP\".  Communication API being used: \"SOCKETS\".  Location where the error was detected: \"[ip-address-removed]\".  Communication function detecting the error: \"connect\".  Protocol specific error code(s): \"61\", \"*\", \"*\".  SQLSTATE=08001 SQLCODE=-30081"

undefined method lookup_cast_type

Hello, after deploying my application to Bluemix this morning I encountered the following error:

An unexpected error occurred during retrieval of column metadata: undefined method 'lookup_cast_type' for #<ActiveRecord::ConnectionAdapters::IBM_DBAdapter:0x00000004af58d0>

The method that is run is my current_user method defined as

def current_user
    @current_user ||= User.find(session[:user_id]) if session[:user_id]
end

My ibm_db gem wasn't locked at version 2.5.18 so I guess this occured after the gem got updated to version 2.5.25 when deploying to Bluemix.

Here's the full trace:

vendor/bundle/ruby/1.9.1/gems/ibm_db-2.5.25/lib/active_record/connection_adapters/ibm_db_adapter.rb:1916:in `rescue in columns'
vendor/bundle/ruby/1.9.1/gems/ibm_db-2.5.25/lib/active_record/connection_adapters/ibm_db_adapter.rb:1920:in `columns'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:228:in `yield'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:228:in `default'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:228:in `columns'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:237:in `columns_hash'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/delegation.rb:7:in `columns_hash'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:333:in `find_one'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:314:in `find_with_ids'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:107:in `find'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/querying.rb:5:in `find'
app/controllers/application_controller.rb:25:in `current_user'
vendor/bundle/ruby/1.9.1/gems/paper_trail-3.0.7/lib/paper_trail/frameworks/rails/controller.rb:19:in `user_for_paper_trail'
vendor/bundle/ruby/1.9.1/gems/paper_trail-3.0.7/lib/paper_trail/frameworks/rails/controller.rb:63:in `set_paper_trail_whodunnit'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:429:in `_run__2662212324076846028__process_action__3527141149501712733__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
vendor/bundle/ruby/1.9.1/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
vendor/bundle/ruby/1.9.1/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
vendor/bundle/ruby/1.9.1/gems/omniauth-1.2.2/lib/omniauth/builder.rb:59:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__781023102347202449__call__2521019240069071373__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-ssl-1.3.4/lib/rack/ssl.rb:27:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/rack/thread_handler_extension.rb:85:in `process_request'
vendor/bundle/ruby/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
vendor/bundle/ruby/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
vendor/bundle/ruby/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/request_handler.rb:414:in `block (3 levels) in start_threads'
vendor/bundle/ruby/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'
´´´

Hanging instead of exception on IBM_DB.connect

Problem Description
When DB2 is not running, start irb and issue the command IBM_DB.connect(). ruby hangs indefinitely:

    require 'ibm_db'
    conn = IBM_DB.connect("mytest", "user", "password")
    # or
    conn = IBM_DB.connect("DRIVER={IBM DB2 ODBC DRIVER};DATABASE=mytest;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=user;PWD=password;", "", "")

After terminating irb, I note the status code is 146 which appears to be defined as BSM_ERRNO_ECONNREFUSED which makes sense. So it seems the code may detect the refused connection - is it then retrying forever or just 'stuck' somehow? The process does not recover when DB2 is started, indicating that its not able to retry in a recoverable way.

When DB2 is running, both these commands return a working connection, so the connection string and credentials are correct. Not using rails. Not using Active Record.

Expected result
I'd expect to see some kind of error or exception.
Documentation says an Exception should be thrown.
I saw another issue where a Connection Refused error was raised on OS X, so it seems that error is raised appropriately in a similar environment.

Any ideas why the driver might hang? Or what I should do to get more debugging information about the source of the problem?

Alternative approaches/investigations

  1. Yes, I could use ruby's Timeout::timeout to create my own timeout, but that requires another thread to establish each connection and Timeout brings other issues that I'd prefer to avoid if possible (especially since it seems that the error handling is already built into IBM_DB).
  2. Also tried adding tcp timeout parameter (its not clear to me if this is in fact supported in this context). It does not stop the code working when DB2 is running. It does not timeout the connection attempt when DB2 is not running.
    ...;PROTOCOL=TCPIP;TCPIPTIMEOUT=3;USER=...
  3. Tried tracer.rb but it appears to be less appropriate when debugging C extensions

Environment

  • Mac OS X 10.11
  • Ruby installed via brew
  • ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
  • gem v.2.4.5.1
  • ibm_db (3.0.0 x86_64-darwin-14)
  • DB2 Express-C 10.1 for OS X installed to /Users/richard/sqllib
  • set environment before installing gem and before running test:
    IBM_DB_DIR=/Users/richard/sqllib/
    IBM_DB_INCLUDE=/Users/richard/sqllib/include
    IBM_DB_LIB=/Users/richard/sqllib/lib64

Segmentation fault if any argument to IBM_DB.connect is nil

Ruby version: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
DB2 client driver: IBM Data Server Driver Package (DS Driver) 10.5 for Linux

/opt/ibm/dsdriver/cfg/db2dsdriver.cfg:

<configuration>
   <dsncollection>
      <dsn alias="mydb" name="mydb" host="localhost" port="50001"/>
   </dsncollection>
</configuration>

Note: localhost:50001 is actually forwarded to a remote DB2 instance over SSH.

I found this kind of by accident when I was trying to connect using a hash value that didn't exist (due to a misspelling):

conn = IBM_DB.connect(@config['dsn_alias'], @config['userame'], @config['password'])

@config['userame'] is unsurprisingly nil, and Ruby segfaults:

harness.rb:13: [BUG] Segmentation fault at 0x00000000000008
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0011 e:000010 CFUNC  :connect
c:0002 p:0061 s:0005 E:002110 EVAL   harness.rb:13 [FINISH]
c:0001 p:0000 s:0002 E:001378 TOP    [FINISH]

-- Ruby level backtrace information ----------------------------------------
harness.rb:13:in `<main>'
harness.rb:13:in `connect'

-- C level backtrace information -------------------------------------------
ruby(+0x188efc) [0x7ffd6e3afefc]
ruby(+0x1fb823) [0x7ffd6e422823]
ruby(rb_bug+0xb3) [0x7ffd6e423a03]
ruby(+0xfdf8f) [0x7ffd6e324f8f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7ffd6ddf4340] ../nptl/sysdeps/pthread/funlockfile.c:29
ruby(rb_str_export_to_enc+0xc) [0x7ffd6e341f9c]
/home/jeff/.gem/ruby/2.1.3/extensions/x86_64-linux/2.1.0-static/ibm_db-2.5.18/ibm_db.so(ibm_db_connect+0x1b9) [0x7ffd6c3d2799] ../nptl/pthread_mutex_lock.c:430
ruby(+0x180bb1) [0x7ffd6e3a7bb1]
ruby(+0x177194) [0x7ffd6e39e194]
ruby(+0x17addf) [0x7ffd6e3a1ddf]
ruby(rb_iseq_eval_main+0x1f6) [0x7ffd6e3adb46]
ruby(+0x22a8f) [0x7ffd6e249a8f]
ruby(ruby_run_node+0x2d) [0x7ffd6e24d3ad]
ruby(+0x2266b) [0x7ffd6e24966b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7ffd6d2fcec5] libc-start.c:287
ruby(+0x22699) [0x7ffd6e249699]

It seems to do the same thing if any argument to IBM_DB.connect is nil.

DEPRECATION WARNING: `serialized_attributes` is deprecated without replacement, and will be removed in Rails 5.0.

I'm getting the following deprecation warning running migrations with ibm_db on Rails 4.2.3:

DEPRECATION WARNING: `serialized_attributes` is deprecated without replacement, and will be removed in Rails 5.0.

It's breaking a migration that also creates an activerecord object with a text field. Here's an edited stacktrace:

DEPRECATION WARNING: `serialized_attributes` is deprecated without replacement, and will be removed in Rails 5.0. (called from create_ssh_key at /Users/leonsp/Projects/IMCloudAPI/app/models/user.rb:445)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `call' for :notice:Symbol
...
NoMethodError: undefined method `call' for :notice:Symbol
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/deprecation/reporting.rb:19:in `block (2 levels) in warn'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/deprecation/reporting.rb:19:in `each'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/deprecation/reporting.rb:19:in `block in warn'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/deprecation/reporting.rb:18:in `tap'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/deprecation/reporting.rb:18:in `warn'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/deprecation/instance_delegator.rb:19:in `warn'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/attribute_methods/serialization.rb:56:in `serialized_attributes'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/ibm_db-2.5.27-x86_64-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:98:in `block (2 levels) in handle_lobs'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/ibm_db-2.5.27-x86_64-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:82:in `each'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/ibm_db-2.5.27-x86_64-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:82:in `block in handle_lobs'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/ibm_db-2.5.27-x86_64-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:70:in `each'
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/ibm_db-2.5.27-x86_64-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:70:in `handle_lobs'
...
/Users/leonsp/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/persistence.rb:142:in `save!'
...

Could you please refactor ibm_db to remove the deprecation warning?

Rails 4.2 - TypeError: superclass mismatch for class ToSql

When executing rake db:migrate the following error is received on a Rails 4.2.0 app running Ruby 2.1.5:

TypeError: superclass mismatch for class ToSql
/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ibm_db-2.5.18/lib/active_record/connection_adapters/ibm_db_adapter.rb:2975:in `module:Visitors'

After investigation, I see where the base class of ToSql was changed from Arel::Visitors::Visitor to Arel::Visitors::Reduce via commit rails/arel@a6a7c75#diff-a044319ea18758df55167af00a0250d9R17.

I have changed the base class of ToSql to Arel::Visitors::Reduce in this gem, however that leads to another issue:

ArgumentError: wrong number of arguments (1 for 2)
/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/arel-6.0.0/lib/arel/visitors/reduce.rb:6:in accept' /home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ibm_db-2.5.18/lib/active_record/connection_adapters/ibm_db_adapter.rb:731:into_sql'

This is happening for a deeper reason that what I have explored so far...

scopes with .uniq

Hello there,

Your gem appears to ignore ".uniq" on scopes. So while the following works with standard Rails, and even functions when using a gem to support Oracle, it does not work with the DB2 gem:

scope :foo, -> { joins(:things).where("things.column = 'bar'").uniq }

All work arounds introduce their own set of issues that are undesirable, it'd be great if ".uniq" worked.

~ Thanks

It doesn't work in multiple connections

Rails supports multiple connections, but these drivers change queries created by other drivers. You should them work only in the context of the model connection.

Error with ISO-8859-15 and Rails 4.2, Arel 6.0, ibmdb 2.5.27

Hi,

i have found a error when database has codepage set to 923 (iso-8859-15) in Rails 4.2 and ibmdb 2.5.27.

Show this example:

require 'ibm_db.so'
conn_string = 'DRIVER={IBM DB2 ODBC DRIVER};DATABASE=develop;HOSTNAME=db2;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=db2inst1;'
conn = IBM_DB.connect(conn_string, 'db2inst1', 'db2inst1')
IBM_DB::exec conn,"Insert into companies (name, code) values('García','006')"

stmt = IBM_DB.prepare(conn, "Insert into companies (name, code) values(?,?)")
values = [ "García", "101" ]
IBM_DB.execute(stmt,values)

Data in database table:

NAME    CODE    
García 006       -> INCORRECT
García  101      -> CORRECT

rake db:migrate throwing error

My PC is 64-bit Linux platform. Rails version I am using 4.1.1 . While I was trying to run rake db:migrate it throwing following error:-

ruby /home/tanmay/.rvm/gems/ruby-2.2.0/bin/rake db:migrate: symbol lookup error: /home/tanmay/.rvm/gems/ruby-2.2.0/gems/ibm_db-2.5.18/lib/ibm_db.so: undefined symbol: rb_thread_blocking_region

My LD_LIBRARY_PATH is follow:-

/home/tanmay/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32

thanks in advance

ibm_db gem do not support Ruby 2.2.x on Mac OS X

Hi,
While implementing support for Ruby 2.2.x on Mac OS X in ibm_db gem, we get segmentation fault error and this seems to be arising from ruby. Until this is resolved we can not support Ruby 2.2.x on Mac OS X.

We are working on this, please watch out this issue for updates.

remove_column appears to be using an old implementation

It appears that the gem is implementing a rather dated version of remove_column that only accepts two parameters:

remove_column :foo_table, :bar_column

as opposed to the version created for migrations utilizing the "change" method that accepts three columns:

remove_column :foo_table, :bar_column, :string

A work around for this is to not use the "change" method in your migrations that remove columns, but instead implement the older "up" and "down" methods.

While this isn't a huge issue I thought I'd bring it up just incase you want an excuse to work on rails stuff at IBM =]

Better Documentation

Better documentation for standard issues would be nice. Or a decent walk through

Foreign Key problem

I'm using ruby 2.1.5, rails 4.2.1, ibmdb 2.6.0
Have tables :users and :requests
When I make migration:

class AddForeignKeys < ActiveRecord::Migration
  def change
    add_foreign_key(:requests, :users, on_delete: :cascade)
  end
end

I have next result:

spring rake --trace db:migrate
** Invoke db:migrate (first_time)
== 20150701155334 AddForeignKeys: migrating ===================================
** Invoke environment (first_time)
-- add_foreign_key(:requests, :users, {:on_delete=>:cascade})
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
   -> 0.0001s
== 20150701155334 AddForeignKeys: migrated (0.0004s) ==========================

** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:schema:dump

Process finished with exit code 0

BUT, when I check db2 tables via dbvisualizer - there is no any records about foreign keys

Connect to IBM i with Client Access Solution

Hi,

I try to use your adapter with IBM i Client Access Solution for linux. I can connect to my server with my ODBC data source.
When I try to use it with your gem, it fails with license error. The IBM i support told me that your gem should use DB2 Connect instead of my ODBC Datasource. Is it possible to fix that ?

Rails connecting to IDS - Not recognising Table

I am trying to build a Rails(4.0.12, same issue in 4.1.8) application to connect to an existing IDS database (12.10.FC1X4).
Columns in table:
table
Model:
model
Output:
outputpo
I am expecting to get the entire row back from the DB
Running SQL Directly:
sql-results

If I query for non-existing records I do get errors as expected.

Does anyone know what I am doing wrong?
I believe the issue is that the SERIAL8 datatype is not being mapped to a ruby data type (integer I would assume).

Any assistance would be greatly appreciated

Kind Regards,

Stian Henriksen

Version 2.5.25 fails to install on Mac OS X

OS
Mac OS X Yosemite 10.10.2 (Darwin 14.1.0)

Command

$ gem install ibm_db -v '2.5.25'

Error

linking shared-object ibm_db.bundle
ld: unknown option: -R$ORIGIN/clidriver/lib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ibm_db.bundle] Error 1

make failed, exit code 2

Apparently OS X's ld does not have the -R option. Please let me know if you need more details.

rake db:migrate fails when using this gem with mysql

We have a situation where we have an existing codebase using mysql. We need to talk to an IBM DB2 database but have chosen not to use the activerecord adapter, instead calling the IBM_DB class directly.

I noticed the ibm_db adapter code is being called even though I have not configured my app to talk to ibm db via activerecord. How can the two work together?

Running a migration which creates a table yields the following:

$ RAILS_ENV=test bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20150602202032 CreateRecoverAppActionLogs: migrating =======================
-- create_table(:recover_app_action_logs)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

undefined method `has_key?' for "int(11) auto_increment PRIMARY KEY":String/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/ibm_db-2.5.26-universal-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:517:in `column'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:115:in `primary_key'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:199:in `create_table'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:462:in `create_table'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/Users/username/workspace/app/db/migrate/20150602202032_create_table.rb:3:in `change'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:606:in `exec_migration'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1043:in `ddl_transaction'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/username/.rbenv/versions/2.1.6/bin/rake:23:in `load'
/Users/username/.rbenv/versions/2.1.6/bin/rake:23:in `<main>'
NoMethodError: undefined method `has_key?' for "int(11) auto_increment PRIMARY KEY":String
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/ibm_db-2.5.26-universal-darwin-14/lib/active_record/connection_adapters/ibm_db_adapter.rb:517:in `column'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:115:in `primary_key'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:199:in `create_table'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:462:in `create_table'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/Users/username/workspace/app/db/migrate/20150602202032_create_table.rb:3:in `change'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:606:in `exec_migration'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1043:in `ddl_transaction'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/username/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/username/.rbenv/versions/2.1.6/bin/rake:23:in `load'
/Users/username/.rbenv/versions/2.1.6/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate

How to locally build ibm_db gem

I have a local checkout of the gem which I am customizing. Id like to pack the gem and use it on my project however there are some unexpected differences.

$ cd ~/workspace/ruby-ibmdb/IBM_DB_Adapter/ibm_db
$ gem build IBM_DB.gemspec.MacOS # produces .gem file

When I use this gem I get:

~/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- ibm_db.so

After unpacking both the original working gem and the one I built myself, I quickly noticed a difference between the files within the gem.

Original gem:

$ cd vendor/cache/ibm_db-2.5.26-universal-darwin-14/lib
$ cat IBM_DB.rb # shows https://github.com/ibmdb/ruby-ibmdb/blob/master/IBM_DB_Adapter/ibm_db/lib/IBM_DB.rb.MacOS
$ cat IBM_DB.rb.MacOS # this does not exist

Gem I built myself:

$ cd vendor/cache/ibm_db-2.5.26-universal-darwin-14/lib
$ cat IBM_DB.rb # shows https://github.com/ibmdb/ruby-ibmdb/blob/master/IBM_DB_Adapter/ibm_db/lib/IBM_DB.rb
$ cat IBM_DB.rb.MacOS # this exists

How do I build the gem correctly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.