ibmdb / ruby-ibmdb

Rails Adapter/Ruby driver for IBM DB2 and IBM Informix
43 stars 49 forks source link

Hanging instead of exception on IBM_DB.connect #43

Closed finalstep closed 4 years ago

finalstep commented 9 years ago

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

    IBM_DB_DIR=/Users/richard/sqllib/
    IBM_DB_INCLUDE=/Users/richard/sqllib/include
    IBM_DB_LIB=/Users/richard/sqllib/lib64
finalstep commented 9 years ago

On further experimentation, it seems that IBM_DB hangs on (perhaps) any error. Executing a prepared statement with a syntax error in it caused IBM_DB to hang. Trying the same statement in the CLI gives the SQLCODE. I wonder what I could have done to cause a hang on any error? Any ideas would be much appreciated. I set db2ckpw owned by root and suid to enable system authentication (in case its relevant).

arvindgu commented 9 years ago

I am not able to reproduce this. I get error message immediately as below when try to create connection.

conn = IBM_DB.connect("sample", "user", "password") UncaughtThrowError: 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: Communication function detecting the error: \"connect\". Protocol specific error code(s): \"60\", \"\", \"\". SQLSTATE=08001 SQLCODE=-30081"

or conn = IBM_DB.connect("DRIVER={IBM DB2 ODBC DRIVER};DATABASE=mytest;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=user;PWD=password;", "", "") UncaughtThrowError: 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: \"127.0.0.1\". Communication function detecting the error: \"connect\". Protocol specific error code(s): \"61\", \"\", \"\". SQLSTATE=08001 SQLCODE=-30081"

Do not set environment variables IBM_DB_DIR , IBM_DB_INCLUDE , IBM_DB_LIB before or after ibm_db gem installation. Please try re-installing ibm_db gem without setting these environment variables.

After ibm_db gem installation, you need to specify connection details in db2dsdriver.cfg file. Default location of db2dsdriver.cfg file would be GEM_HOME/gems_rb220_rails420/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/cfg.

finalstep commented 9 years ago

Hi Arvind, thank you for the prompt reply.

  1. I understand its working for you, so its likely to be something in my environment rather than a problem with the gem code. I'm trying to understand what in my environment it might be. Hopefully when this is sorted out I'll also get those errors instead of an endless loop.
  2. I understand that the environment variables should not be set. DB2 Express-C modifies .profile to run db2profile which sets those environment variables. I commented it out so a standard shell no longer sets those variables. Then reinstalled without those variables set.
  3. I understand the recommendation relating to db2dsdriver.cfg to be optional since the gem works fine with a full connection string and the docs indicate a full connection string takes precedence over db2dsdriver.cfg. I'll continue without using db2dsdriver.cfg unless there is some other reason that should be considered.
  4. I'm attaching some debugging information to highlight where the hanging loop occurs. In summary, I uninstalled the gem and reinstalled it with no environment variables set. It appears to have installed ok, but when required it cannot find libdb2.dylib (see detailed log below). If we tell it where to find it by setting DYLD_LIBRARY_PATH and try again, the gem loads ok. But now when we try to connect it gets itself into an endless loop, making about 20 system calls a second, but never returning an error. The list of open files shows that the libdb2.dylib was loaded ok.

It looks like the hang occurs inside _ruby_ibm_db_connect_helper(), I guess at the call to ibm_Ruby_Thread_Call() which calls rb_thread_call_without_gvl() line 698 (since ruby's version is 2.2.3, installed by brew, not the standard v2.0.0 that comes with OS X 10.11).

installing the gem with no extra environment variables

richard@aqua ~$ gem install ibm_db
Fetching: ibm_db-3.0.0-x86_64-darwin-14.gem (100%)
Building native extensions.  This could take a while...

*****************************************************************************
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). Your use of the components of the package and dependencies constitutes your acceptance of their respective license agreements.  If you do not accept the terms of any license agreement(s), then delete the relevant component(s) from your system/device.
*****************************************************************************

Successfully installed ibm_db-3.0.0-x86_64-darwin-14
Parsing documentation for ibm_db-3.0.0-x86_64-darwin-14
Installing darkfish documentation for ibm_db-3.0.0-x86_64-darwin-14
Done installing documentation for ibm_db after 19 seconds
1 gem installed

So far so good. Let's see if the gem loads ok:

richard@aqua ~$ irb
irb(main):001:0> require 'ibm_db'
LoadError: dlopen(/usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle, 9): Library not loaded: libdb2.dylib
  Referenced from: /usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle
  Reason: image not found - /usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from (irb):1
    from /usr/local/bin/irb:11:in `<main>'
irb(main):002:0>

richard@aqua ~$ otool -L /usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle
/usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle:
    /usr/local/opt/ruby/lib/libruby.2.2.0.dylib (compatibility version 2.2.0, current version 2.2.0)
    libdb2.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

No it doesn't. The bundle is looking for the libdb2.dylib. As shown above in otool output, the dylib has no path and no version info. Let's tell the gem where to find the dylib:

richard@aqua ~$ export DYLD_LIBRARY_PATH=/usr/local/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/lib/
richard@aqua ~$ ruby -ribm_db -e'conn=IBM_DB.connect("mytest","user","secret")'

So now it loads without any complaints, but it hangs in a loop. Let's see what its doing with Activity Monitor:

PID = 6241 CPU usage is very low 0.03-0.04% About 20 system calls per second going on.

Open Files:

/Users/richard
/usr/local/Cellar/ruby/2.2.3/bin/ruby
/usr/local/Cellar/ruby/2.2.3/lib/libruby.2.2.0.dylib
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/encdb.bundle
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/transdb.bundle
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/thread.bundle
/usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle
/usr/local/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/lib/libdb2.dylib
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/bigdecimal.bundle
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/utf_16le.bundle
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/utf_16_32.bundle
/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/single_byte.bundle
/usr/lib/dyld
/private/var/db/dyld/dyld_shared_cache_x86_64
/dev/ttys000
/dev/ttys000
/dev/ttys000
->0x419f1b3dbf2a3e51
->0x419f1b3dd53b1011
->0x419f1b3dbf2a3791
->0x419f1b3dbf2a4151
/private/var/db2/global.reg
Sampling process 6241 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling ruby (pid 6241) every 1 millisecond
Process:         ruby [6241]
Path:            /usr/local/Cellar/ruby/2.2.3/bin/ruby
Load Address:    0x109202000
Identifier:      ruby
Version:         0
Code Type:       X86-64
Parent Process:  bash [6034]

Date/Time:       2015-10-18 13:59:11.099 +1100
Launch Time:     2015-10-18 13:57:29.813 +1100
OS Version:      Mac OS X 10.11 (15A284)
Report Version:  7
Analysis Tool:   /usr/bin/sample
Call graph:
    2834 Thread_1421465   DispatchQueue_1: com.apple.main-thread  (serial)
    + 2834 start  (in libdyld.dylib) + 1  [0x7fff918435ad]
    +   2834 main  (in ruby) + 79  [0x109203f26]
    +     2834 ruby_run_node  (in libruby.2.2.0.dylib) + 78  [0x109241ee1]
    +       2834 ruby_exec_internal  (in libruby.2.2.0.dylib) + 148  [0x109241fa4]
    +         2834 rb_iseq_eval_main  (in libruby.2.2.0.dylib) + 138  [0x1093450c6]
    +           2834 vm_exec  (in libruby.2.2.0.dylib) + 135  [0x109344826]
    +             2834 vm_exec_core  (in libruby.2.2.0.dylib) + 8376  [0x1093394b4]
    +               2834 vm_call_method  (in libruby.2.2.0.dylib) + 730  [0x10934dbd1]
    +                 2834 vm_call_cfunc  (in libruby.2.2.0.dylib) + 801  [0x10934e475]
    +                   2834 _ruby_ibm_db_connect_helper  (in ibm_db.bundle) + 790  [0x10977a136]
    +                     2834 call_without_gvl  (in libruby.2.2.0.dylib) + 146  [0x109355984]
    +                       2834 gvl_acquire_common  (in libruby.2.2.0.dylib) + 71  [0x10935a62e]
    +                         2834 native_cond_wait  (in libruby.2.2.0.dylib) + 9  [0x10935a125]
    +                           2834 _pthread_cond_wait  (in libsystem_pthread.dylib) + 767  [0x7fff8b8cc73d]
    +                             2834 __psynch_cvwait  (in libsystem_kernel.dylib) + 10  [0x7fff971e3f5e]
    2834 Thread_1421468: ruby-timer-thr
      2834 thread_start  (in libsystem_pthread.dylib) + 13  [0x7fff8b8c9385]
        2834 _pthread_start  (in libsystem_pthread.dylib) + 168  [0x7fff8b8cb92e]
          2834 _pthread_body  (in libsystem_pthread.dylib) + 131  [0x7fff8b8cb9b1]
            2834 thread_timer  (in libruby.2.2.0.dylib) + 286  [0x10935a94f]
              2834 poll  (in libsystem_kernel.dylib) + 10  [0x7fff971e544a]

Total number in stack (recursive counted multiple, when >=5):

Sort by top of stack, same collapsed (when >= 5):
        __psynch_cvwait  (in libsystem_kernel.dylib)        2834
        poll  (in libsystem_kernel.dylib)        2834
Binary Images:
       0x109202000 -        0x109203fff +ruby (0) <26FC5547-7359-39D9-AA94-0E4EA589927C> /usr/local/bin/ruby
       0x10920c000 -        0x1093d8ff7 +libruby.2.2.0.dylib (0) <183CA8E4-5AFB-3F90-95F8-71989A7FFAEA> /usr/local/Cellar/ruby/2.2.3/lib/libruby.2.2.0.dylib
       0x109760000 -        0x109762fff +encdb.bundle (0) <F5690D2E-44C0-3493-8572-2AB0ECF77E89> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/encdb.bundle
       0x109765000 -        0x109767fff +transdb.bundle (0) <85E76BAC-93AC-3DE0-929B-F34DB92CD8A3> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/transdb.bundle
       0x10976a000 -        0x10976cfff +thread.bundle (0) <DCBCB09B-BF05-3376-9BB8-7D2F1A6415C0> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/thread.bundle
       0x10976f000 -        0x109784ff7 +ibm_db.bundle (0) <F09AC780-1A4A-391E-8230-87F85D098888> /usr/local/lib/ruby/site_ruby/2.2.0/x86_64-darwin14/ibm_db.bundle
       0x10978f000 -        0x10af9efe7 +libdb2.dylib (0) <815FA334-56C1-375E-A2C8-9F4238A1DEEB> /usr/local/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/lib/libdb2.dylib
       0x10b3fd000 -        0x10b409ff7 +bigdecimal.bundle (0) <FCC18121-AB75-3E9E-B85B-E2A43E2A2EFA> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/bigdecimal.bundle
       0x10b40e000 -        0x10b40ffff +utf_16le.bundle (0) <76C0AB29-2443-37FA-9D2B-F6D9AB297537> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/utf_16le.bundle
       0x10b412000 -        0x10b414ff7 +utf_16_32.bundle (0) <7934ABAE-D054-30D1-A93F-F59C83B8F232> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/utf_16_32.bundle
       0x10b593000 -        0x10b5a7fff +single_byte.bundle (0) <EFE2B53C-0AD7-3B76-ABB0-45276B5F1C08> /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/single_byte.bundle
    0x7fff67096000 -     0x7fff670ccf5f  dyld (0.0 - ???) <DF977301-4A63-32ED-9939-1EE3122D18D4> /usr/lib/dyld
    0x7fff880c5000 -     0x7fff880c6fff  libsystem_blocks.dylib (65) <1B4F1F10-823E-3781-8162-6884D14DF0D6> /usr/lib/system/libsystem_blocks.dylib
    0x7fff88561000 -     0x7fff88569fef  libsystem_platform.dylib (73.1.1) <3F4D2390-E3DE-3C24-A515-95DFAC8671C4> /usr/lib/system/libsystem_platform.dylib
    0x7fff8a13b000 -     0x7fff8a143fff  libsystem_networkextension.dylib (384.1.2) <4736FCC5-9DBA-31F4-AAC8-CD0A177CF502> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff8b8c8000 -     0x7fff8b8d1ff7  libsystem_pthread.dylib (137.1.1) <1373D0F1-C6CA-364E-A6BA-8BDBD0D34670> /usr/lib/system/libsystem_pthread.dylib
    0x7fff8b985000 -     0x7fff8b986ffb  libremovefile.dylib (41) <C7CFF5F2-AFFB-3C8D-BDB4-D66D50E657C0> /usr/lib/system/libremovefile.dylib
    0x7fff8b987000 -     0x7fff8b99bfff  libsystem_coretls.dylib (82) <21EDACF1-D9B3-3086-9821-60EB75E7F965> /usr/lib/system/libsystem_coretls.dylib
    0x7fff8b99c000 -     0x7fff8b99cff7  libunc.dylib (29) <D9B0C7B1-8648-3AAC-931C-E7CD362FAA8A> /usr/lib/system/libunc.dylib
    0x7fff8ba4e000 -     0x7fff8ba53ff3  libunwind.dylib (35.3) <FDA18078-A775-3BAF-A5A6-8A7B75D6AA99> /usr/lib/system/libunwind.dylib
    0x7fff8be89000 -     0x7fff8be89ff7  libkeymgr.dylib (28) <47080280-8B57-3D75-8A20-9E100864DE27> /usr/lib/system/libkeymgr.dylib
    0x7fff8bf76000 -     0x7fff8bf7effb  libsystem_dnssd.dylib (624.1.2) <DB6AB206-4AD8-369D-BF57-1D246AD60582> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff8c0fd000 -     0x7fff8c108ff7  libcommonCrypto.dylib (60074) <BD1DCF19-8353-3F6A-AFFA-EBBA29A302A8> /usr/lib/system/libcommonCrypto.dylib
    0x7fff8c3ed000 -     0x7fff8c409ff3  libresolv.9.dylib (60) <B192EC27-84EC-3D8A-9CBF-0374B5C9B31A> /usr/lib/libresolv.9.dylib
    0x7fff8c789000 -     0x7fff8c800fc7  libcorecrypto.dylib (334) <4E1B969F-8449-3B21-9880-51AD58E25AA6> /usr/lib/system/libcorecrypto.dylib
    0x7fff8cb25000 -     0x7fff8cb28fff  libsystem_sandbox.dylib (459.1.8) <2F36D536-482C-39EC-BAFD-72297728F0A4> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff8cc60000 -     0x7fff8cc89fff  libxpc.dylib (755.1.19) <3E09C275-A33B-357A-B0AB-A2DDF88EC9D5> /usr/lib/system/libxpc.dylib
    0x7fff8d0bb000 -     0x7fff8d0e4fff  libc++abi.dylib (125) <F5027B46-1801-344D-BD51-2E6D188C8900> /usr/lib/libc++abi.dylib
    0x7fff8d2de000 -     0x7fff8d2e7ffb  libsystem_notify.dylib (149) <56ABC155-CB99-30A8-A8B1-C204B5615092> /usr/lib/system/libsystem_notify.dylib
    0x7fff8daab000 -     0x7fff8dad8fff  libdispatch.dylib (500.1.5) <6B38497E-9448-3433-9D6B-6223F2A99431> /usr/lib/system/libdispatch.dylib
    0x7fff8e95f000 -     0x7fff8e98efc3  libsystem_m.dylib (3105) <07D50372-30ED-3B03-9FA0-0662BF8F0098> /usr/lib/system/libsystem_m.dylib
    0x7fff8fb83000 -     0x7fff8fb85fff  libsystem_coreservices.dylib (19) <692631A0-1923-32CA-9BD5-044B1382FFDE> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff9053b000 -     0x7fff908a5ddf  libobjc.A.dylib (680) <CE3C3C78-A7BB-3147-8375-55424032FF5E> /usr/lib/libobjc.A.dylib
    0x7fff90e19000 -     0x7fff90e1affb  libSystem.B.dylib (1225.1.1) <E48AAE3F-370E-34AE-AECA-4CA28F211479> /usr/lib/libSystem.B.dylib
    0x7fff911de000 -     0x7fff911e0ff7  libquarantine.dylib (80) <1693C5FE-EA0A-3122-85EB-7950ECC7435A> /usr/lib/system/libquarantine.dylib
    0x7fff91840000 -     0x7fff91843ffb  libdyld.dylib (360.14) <F9D64D8C-4C33-3D06-B7F8-697F13292894> /usr/lib/system/libdyld.dylib
    0x7fff91980000 -     0x7fff91981fff  libsystem_secinit.dylib (20) <932ED582-E80F-39DA-B0FA-F1BC5F1AD2F8> /usr/lib/system/libsystem_secinit.dylib
    0x7fff924a6000 -     0x7fff924bdfff  libsystem_asl.dylib (322) <97D794DA-8CE5-3676-AC5E-364F6D172BDA> /usr/lib/system/libsystem_asl.dylib
    0x7fff93075000 -     0x7fff930c8ff7  libc++.1.dylib (120.1) <54190E1B-EE49-3D6D-AC29-2813D7380BA5> /usr/lib/libc++.1.dylib
    0x7fff93af4000 -     0x7fff93afbff7  libcompiler_rt.dylib (62) <253B36E5-572D-377D-AE99-A02CE32590E5> /usr/lib/system/libcompiler_rt.dylib
    0x7fff949c7000 -     0x7fff949c9ff7  libsystem_configuration.dylib (801.1.1) <EB55C3D8-048D-350E-BF24-0CBD4479D51C> /usr/lib/system/libsystem_configuration.dylib
    0x7fff94f5e000 -     0x7fff94f7aff7  libsystem_malloc.dylib (67) <1B57A614-3D60-3F87-876F-7DB4AF38120F> /usr/lib/system/libsystem_malloc.dylib
    0x7fff94fb4000 -     0x7fff95002ff7  libstdc++.6.dylib (104.1) <77780A99-22DB-35AA-BD9E-ADB83417E4BD> /usr/lib/libstdc++.6.dylib
    0x7fff95079000 -     0x7fff95286fff  libicucore.A.dylib (551.24) <DEB70F32-DA94-323B-B6D1-03D09C8FB10C> /usr/lib/libicucore.A.dylib
    0x7fff95301000 -     0x7fff95309fff  libcopyfile.dylib (127) <CA2602AB-E8B7-3CD8-A0C5-D86E35FDA09F> /usr/lib/system/libcopyfile.dylib
    0x7fff96d38000 -     0x7fff96d49ff7  libsystem_trace.dylib (200) <E26A91EA-AD67-3FA2-A3B6-79A93DCC716E> /usr/lib/system/libsystem_trace.dylib
    0x7fff971c7000 -     0x7fff971ccff7  libmacho.dylib (875.1) <A9EC23EC-11A0-3B4F-A8AC-B990C8267A6E> /usr/lib/system/libmacho.dylib
    0x7fff971cd000 -     0x7fff971ebfff  libsystem_kernel.dylib (3247.1.106) <7DD242A1-E2BF-39D1-8787-B174046E4F15> /usr/lib/system/libsystem_kernel.dylib
    0x7fff98483000 -     0x7fff98483ff7  liblaunch.dylib (755.1.19) <7EC0F297-43CC-3D11-B46B-7E72E372648A> /usr/lib/system/liblaunch.dylib
    0x7fff99371000 -     0x7fff993b7ff7  libauto.dylib (186) <460B0167-C89B-37EC-823C-52F684B31C26> /usr/lib/libauto.dylib
    0x7fff9a939000 -     0x7fff9a962ff7  libsystem_info.dylib (476) <65D0643A-C8AE-3E8D-9F6E-E4AD823F16B2> /usr/lib/system/libsystem_info.dylib
    0x7fff9ab30000 -     0x7fff9afa4ff7  com.apple.CoreFoundation (6.9 - 1253) <A8A44D66-A3B2-3B5D-B75B-EC2DC968F4BD> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff9afa5000 -     0x7fff9b032fe7  libsystem_c.dylib (1081.1.3) <A60CE86D-1FF3-32AD-A672-C7597F884529> /usr/lib/system/libsystem_c.dylib
    0x7fff9b1aa000 -     0x7fff9b1bbfff  libz.1.dylib (60) <43317BEA-ACA2-34C2-AF37-902AA926C83A> /usr/lib/libz.1.dylib
    0x7fff9b21d000 -     0x7fff9b27bfff  libsystem_network.dylib (582.1.4) <14ECA259-D471-3E47-A843-FF0990577893> /usr/lib/system/libsystem_network.dylib
    0x7fff9bb0d000 -     0x7fff9bb11fff  libcache.dylib (75) <4948E2C8-867F-3E9D-AAE7-2F30F0B345C6> /usr/lib/system/libcache.dylib
    0x7fff9be6b000 -     0x7fff9be6cfff  libDiagnosticMessagesClient.dylib (100) <F2D8CFCC-A00A-3675-9C01-EF0C663F2445> /usr/lib/libDiagnosticMessagesClient.dylib
Sample analysis of process 6241 written to file /dev/stdout
williamweckl commented 9 years ago

I'm with the same problem. The gem installs ok, if I require ibm_db it does not show any error but when I try to connect it stucks and no errors appears. What could I'm doing wrong?

update Also noted that my folder GEM_HOME/gems_rb220_rails420/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver does not exists.

arvindgu commented 9 years ago

@finalstep

Could you please confirm whether you are able to connect using cli commands (without Ruby)?

To investigate why it hangs, please provide db2 trace? The instructions are as below.

Open two command prompt. One is to capture db2trc and another is to create connection from ruby.

  1. In first command prompt run below .
    cd /usr/local/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/adm
  2. In both the command prompt set the DYLD_LIBRARY_PATH export DYLD_LIBRARY_PATH=/usr/local/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/lib/:DYLD_LIBRARY_PATH
  3. In first command prompt run below ./db2trc on -f /db2trc.dump
  4. In second command prompt Try connecting to DB2. ruby -ribm_db -e'conn=IBM_DB.connect("mytest","user","secret")'
  5. In first command prompt run below
    1. ./db2trc off
    2. ./db2trc fmt /db2trc.dump /db2trc.fmt
    3. ./db2trc fmt -c /db2trc.dump /db2trc.drda
    4. ./db2trc fmt-cli /db2trc.dump /db2trc.cli
    5. ./db2trc flw /db2trc.dump /db2trc.flw
    6. Send the .fmt, .drda, .cli and .flw file.

You can refer below link, if you need any help regarding db2trc. http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.trb.doc/com.ibm.db2.luw.admin.trb.doc-gentopic1.html?lang=en

Thanks, Arvind

arvindgu commented 9 years ago

@williamweckl , can you check in the directory where all the gems are geting installed, in that directory folder ibm_db-3.0.0-x86_64-darwin-14 should be present.

finalstep commented 9 years ago

Hi Arvind,

Thanks for the precise instructions. The dump files are attached.

yes, I can connect to the database using the DB2 command line tools:

richard@aqua ~$ . sqllib/db2profile
richard@aqua ~$ db2 connect to mytest

   Database Connection Information

 Database server        = DB2/DARWIN 10.1.0
 SQL authorization ID   = RICHARD
 Local database alias   = MYTEST

On 20 Oct 2015, at 5:35 PM, Arvind Gupta notifications@github.com wrote:

./db2trc flw /db2trc.dump /db2trc.flw

arvindgu commented 9 years ago

@finalstep, I can't find the attached files. Could you please send them to me directly. arvindgu@in.ibm.com

arvindgu commented 9 years ago

@finalstep Thanks for providing the db2 traces. Looking at the traces, I do not any hang and see below expected error in db2trc.cli trace file which is expected.

SQLGetDiagRecW( pszSqlState=" ", pfNativeError=-1531, pszErrorMsg="[IBM][CLI Driver] SQL1531N The connection failed because the name specified with the DSN connection string keyword could not be found in either the db2dsdriver.cfg configuration file or the db2cli.ini configuration file. Data source name specified in the connection string: "MYTEST". ", pcbErrorMsg=286 ) <--- SQL_SUCCESS Time elapsed - +5.400000E-005 seconds

This error message should display on command prompt, whereas it doesn't display in your case. From the db2 traces I doesn't seems any issue with the ibm_db gem.

The only difference I see, I have installed ruby 2.2.3 by building ruby code whereas you have used brew to install ruby.

finalstep commented 9 years ago

Thank you for taking the time to investigate.

I tried installing and testing with the ruby version 2.0.0 that comes with OS X 10.11 and unfortunately got the same result.

arvindgu commented 9 years ago

@finalstep you have mention this problem happens when DB2 is not running. Do you have any problem, when DB2 is running?

finalstep commented 9 years ago

It seems the problem of hanging occurs whenever an error condition arises. Instead of reporting the error, the gem hangs in a loop.

When DB2 is not running and a connection is attempted, that of course produces an error condition and so the gem hangs. When DB2 is running and a connection is attempted with correct credentials, the operation succeeds. When DB2 is running and a connection is attempted with invalid credentials, the gem hangs. When DB2 is running and a connection has been established, and a query is executed with invalid syntax (eg. wrongly named column in a select query) the gem hangs.

One point that might not be significant but I mention for completeness: in order to get the DB2 server authenticating users other than the instance owner, it was necessary to make sqllib/bin/db2ckpw suid root. When db2ckpw was not suid root, the connect method would also just hang.

arvindgu commented 9 years ago

@finalstep Could you please also confirm that all the steps mentioned in DB2 Express-C 10.1 for Mac OS X installation guide are followed https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797#53fa81f5-7c71-4e30-90b3-5f5d7a609a8f

I would like to take a look of db2diag.log, could you please provide it.

finalstep commented 9 years ago

Yes, installed according to the instructions given at the top of that topic (same as those given by krrose on May 20). Prerequisites:

I can connect to DB2 using the DBViewer add-on for eclipse. It also shows the SQLCODE when there is a problem. So that indicated to me that the DB2 server was probably working ok.

On 21 Oct 2015, at 4:38 PM, Arvind Gupta notifications@github.com wrote:

@finalstep https://github.com/finalstep Could you please also confirm that all the steps mentioned in DB2 Express-C 10.1 for Mac OS X installation guide are followed https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797#53fa81f5-7c71-4e30-90b3-5f5d7a609a8f https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797#53fa81f5-7c71-4e30-90b3-5f5d7a609a8f I would like to take a look of db2diag.log, could you please provide it.

— Reply to this email directly or view it on GitHub https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-149788745.

finalstep commented 9 years ago

I'm happy to provide you with a db2diag.log, but not much wiser after reading the docs for db2diag. Would you like to specify the commands you want executed?

On 21 Oct 2015, at 4:38 PM, Arvind Gupta notifications@github.com wrote:

@finalstep https://github.com/finalstep Could you please also confirm that all the steps mentioned in DB2 Express-C 10.1 for Mac OS X installation guide are followed https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797#53fa81f5-7c71-4e30-90b3-5f5d7a609a8f https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797#53fa81f5-7c71-4e30-90b3-5f5d7a609a8f I would like to take a look of db2diag.log, could you please provide it.

— Reply to this email directly or view it on GitHub https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-149788745.

arvindgu commented 9 years ago

ok, could you please try the same scenarios with db2 cli command window and confirm the results.

finalstep commented 9 years ago

Sorry I'm confused:

  1. db2cli doesn't seem to do much. It can validate the config files. The docs mention 'connect' options but there is no 'connect' keyword (unlike 'validate' for example). I'm referring to /usr/local/lib/ruby/gems/2.2.0/gems/ibm_db-3.0.0-x86_64-darwin-14/lib/clidriver/bin/db2cli.
  2. db2cli doesn't open any window
  3. I suspect db2cli is not what you're talking about when you say "db2 cli command window"

This is probably assumed knowledge for experienced DB2 folks - but I'm afraid I'm not one of them :-)

On 21 Oct 2015, at 8:06 PM, Arvind Gupta notifications@github.com wrote:

ok, could you please try the same scenarios with db2 cli command window and confirm the results.

— Reply to this email directly or view it on GitHub https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-149828144.

finalstep commented 9 years ago

If you're talking about the db2 executable that is installed by the server, then here are the results:

When DB2 is not running and connection is attempted, the result is:

SQL1032N  No start database manager command was issued.  SQLSTATE=57019

When DB2 is running and a connection is attempted, the operation succeeds:

richard@aqua ~$ db2start
SQL1063N  DB2START processing was successful.
richard@aqua ~$ db2 connect to mytest

   Database Connection Information

 Database server        = DB2/DARWIN 10.1.0
 SQL authorization ID   = RICHARD
 Local database alias   = MYTEST

When DB2 is running and a connection is attempted to a database that does not exist:

richard@aqua ~$ db2 connect to rubbish
SQL1013N  The database alias name or database name "RUBBISH" could not be
found.  SQLSTATE=42705

So it appears that using the DB2 server's db2 executable, we get correct error messages.

On 21 Oct 2015, at 6:27 AM, Richard Kernahan richard@finalstep.com.au wrote:

It seems the problem of hanging occurs whenever an error condition arises. Instead of reporting the error, the gem hangs in a loop.

When DB2 is not running and a connection is attempted, that of course produces an error condition and so the gem hangs. When DB2 is running and a connection is attempted with correct credentials, the operation succeeds. When DB2 is running and a connection is attempted with invalid credentials, the gem hangs. When DB2 is running and a connection has been established, and a query is executed with invalid syntax (eg. wrongly named column in a select query) the gem hangs.

You previously asked about the CLI tools and I responded by referring to the DB2 server command tool sqllib/bin/db2. I now realise you probably meant the gem.../lib/clidriver/bin/db2cli executable, which I believe needs db2dsdriver.cfg to be set up correctly. So now I understand why you mentioned that config file. I'll test db2cli today and report the results.

One point that might not be significant but I mention for completeness: in order to get the DB2 server authenticating users other than the instance owner, it was necessary to make sqllib/bin/db2ckpw suid root. When db2ckpw was not suid root, the connect method would also just hang.

On 20 Oct 2015, at 10:45 PM, Arvind Gupta notifications@github.com wrote:

finalstep commented 8 years ago

Version 3.0.1 solved this connection problem. Thank you!

ronaldoqueiroz commented 8 years ago

I am facing the same problem, but running version 3.0.4. It is weird because I was running it with no problems. The exception was triggered when I had any connections problems. But suddenly it stop working and now it hangs on any error conditions. If the connection string or the statement is OK, it works. But if I use, the wrong database name, or if the query has an error .. ibm_db hangs forever ...

What have you done to fix it? Just an upgrade to version 3.0.1? As I said I am running 3.0.4 and it was running OK.

I have no idea what could be the problem.

I appreciate any help.

Thank you.

finalstep commented 8 years ago

Hi Ronaldo

Yes, we upgraded to 3.0.1 and were no longer able to reproduce the issue. Hoping the problem had been somehow resolved, I closed the ticket. I wouldn't say we "got it working". I would say that we were unable to reproduce the behaviour after upgrading.

I could not determine what changed from 3.0.0 to 3.0.1 that had any bearing on the issue, and the authors were unable to determine the root cause. Hanging without any diagnostics makes such issues terribly difficult to pinpoint. So, based on your experience with 3.0.4, its likely that the problem is still undiagnosed and is not yet fixed.

We have since abandoned use of this gem, and do not intend to do any more testing with it, so I'm afraid I cannot offer any help.

kind regards Richard

On 13 Jul 2016, at 5:45 AM, ronaldoqueiroz notifications@github.com wrote:

I am facing the same problem, but running version 3.0.4. It is weird because I was running it with no problems. The exception was triggered when I had any connections problems. But suddenly it stop working and now it hangs on any error conditions. If the connection string or the statement is OK, it works. But if I use, the wrong database name, or if the query has an error .. ibm_db hangs forever ...

What have you done to fix it? Just an upgrade to version 3.0.1? As I said I am running 3.0.4 and it was running OK.

I have no idea what could be the problem.

I appreciate any help.

Thank you.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-232157678, or mute the thread https://github.com/notifications/unsubscribe/AAeVZ4aWXsMkkLuqxC-ULXb_D8A1pzG0ks5qU-7bgaJpZM4GP344.

ronaldoqueiroz commented 8 years ago

Thank you Richard for your prompt response,

You are right. It seems to be very unstable, even in 3.0.4. I will give a try again in a fresh linux machine and see if it works. But I am quite uncomfortable with an issue I have no idea what the root cause was. You said you have abandoned this gem. What do you use to access DB2 now?

Thanks anyway for your help

Regards,

Ronaldo

On Tue, Jul 12, 2016 at 10:11 PM, finalstep notifications@github.com wrote:

Hi Ronaldo

Yes, we upgraded to 3.0.1 and were no longer able to reproduce the issue. Hoping the problem had been somehow resolved, I closed the ticket. I wouldn't say we "got it working". I would say that we were unable to reproduce the behaviour after upgrading.

I could not determine what changed from 3.0.0 to 3.0.1 that had any bearing on the issue, and the authors were unable to determine the root cause. Hanging without any diagnostics makes such issues terribly difficult to pinpoint. So, based on your experience with 3.0.4, its likely that the problem is still undiagnosed and is not yet fixed.

We have since abandoned use of this gem, and do not intend to do any more testing with it, so I'm afraid I cannot offer any help.

kind regards Richard

On 13 Jul 2016, at 5:45 AM, ronaldoqueiroz notifications@github.com wrote:

I am facing the same problem, but running version 3.0.4. It is weird because I was running it with no problems. The exception was triggered when I had any connections problems. But suddenly it stop working and now it hangs on any error conditions. If the connection string or the statement is OK, it works. But if I use, the wrong database name, or if the query has an error .. ibm_db hangs forever ...

What have you done to fix it? Just an upgrade to version 3.0.1? As I said I am running 3.0.4 and it was running OK.

I have no idea what could be the problem.

I appreciate any help.

Thank you.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-232157678>, or mute the thread < https://github.com/notifications/unsubscribe/AAeVZ4aWXsMkkLuqxC-ULXb_D8A1pzG0ks5qU-7bgaJpZM4GP344 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-232227675, or mute the thread https://github.com/notifications/unsubscribe/ATevCzUyQuTGoegj_cnIfCNoZMSo8yRwks5qVDskgaJpZM4GP344 .

arvindgu commented 8 years ago

We have several times tried to reproduce this problem, however we could not reproduce. As @finalstep mentioned that the problem went away after upgrading to 3.0.1. Please note we have not fixed this problem in version 3.0.1. @ronaldoqueiroz Are you facing this problem in OS X or Linux or both? If you have not tried, can you please try reinstalling ibm_db gem.

ronaldoqueiroz commented 8 years ago

Thank you Arvind,

I have just installed a fresh linux from scratch and got the same problem as you can see below.

In fact the problem is a little bit different ... Now the frist connection hangs .... but after one successful connection .. inside the same irb session ... the error exceptions work OK.

Any ideas?

I am afraid to use it in production because it is very unstable. If I have any DB problems I cannot trust the exception handling and my code can be hanging without any notice ....

I appreciate any help ...

Thanks in advance

This is my setup

zlinux 64 bits - Red Hat Enterprise Linux Server release 6.7 DB2 Advanced Enterprise 10.5

Versions

[root@simbad ~]# [root@simbad ~]# [root@simbad ~]# uname -a Linux simbad 2.6.32-573.el6.s390x #1 SMP Wed Jul 1 18:26:59 EDT 2015 s390x s390x s390x GNU/Linux [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.7 (Santiago) [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# db2level DB21085I This instance or install (instance name, where applicable: "db2inst1") uses "64" bits and DB2 code release "SQL10053" with level identifier "0604010E". Informational tokens are "DB2 v10.5.0.3", "s140203", "IP23553", and Fix Pack "3". Product is installed at "/opt/ibm/db2/V10.5". [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# ruby -v ruby 2.2.5p319 (2016-04-26 revision 54774) [s390x-linux] [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# rvm -v rvm 1.27.0 (master) by Wayne E. Seguin wayneeseguin@gmail.com, Michal Papis mpapis@gmail.com [https://rvm.io/] [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# gem list

* LOCAL GEMS *

activemodel (5.0.0) activerecord (5.0.0) activesupport (5.0.0) arel (7.0.0) bigdecimal (1.2.6) bundler-unload (1.0.2) concurrent-ruby (1.0.2) executable-hooks (1.3.2) gem-wrappers (1.2.7) i18n (0.7.0) ibm_db (3.0.4) io-console (0.4.3) json (1.8.1) log4r (1.1.10) mini_portile2 (2.1.0) minitest (5.4.3) nokogiri (1.6.8) pkg-config (1.1.7) power_assert (0.2.2) psych (2.0.8) rake (10.4.2) rdoc (4.2.0) rubygems-bundler (1.4.4) rvm (1.11.3.9) test-unit (3.0.8) thread_safe (0.3.5) tzinfo (1.2.2)

Installation steps:

[root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# yum install -y libyaml-devel autoconf readline-devel zlib-devel libffi-devel openssl-devel automake libtool bison sqlite-devel Loaded plugins: product-id, rhnplugin, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. This system may not be registered to RHN Classic or RHN Satellite. SystemId could not be acquired. You can use rhn_register to register. RHN Satellite or RHN Classic support will be disabled. Setting up Install Process Package autoconf-2.63-5.1.el6.noarch already installed and latest version Package readline-devel-6.0-4.el6.s390x already installed and latest version Package zlib-devel-1.2.3-29.el6.s390x already installed and latest version Package matching openssl-devel-1.0.1e-42.el6.s390x already installed. Checking for update. Package automake-1.11.1-4.el6.noarch already installed and latest version Package libtool-2.2.6-15.5.el6.s390x already installed and latest version Package bison-2.4.1-5.el6.s390x already installed and latest version Package matching sqlite-devel-3.6.20-1.el6.s390x already installed. Checking for update. Nothing to do [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# rvm install 2.2 Searching for binary rubies, this might take some time. No binary rubies available for: redhat/6/s390x/ruby-2.2.5. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for redhat. Requirements installation successful. Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.2.5, this may take a while depending on your cpu(s)... ruby-2.2.5 - #downloading ruby-2.2.5, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 12.7M 100 12.7M 0 0 827k 0 0:00:15 0:00:15 --:--:-- 770k ruby-2.2.5 - #extracting ruby-2.2.5 to /usr/local/rvm/src/ruby-2.2.5.... ruby-2.2.5 -

configuring.........................................................

ruby-2.2.5 - #post-configuration.. ruby-2.2.5 -

compiling......................................................................................

ruby-2.2.5 - #installing............................ ruby-2.2.5 - #making binaries executable.. ruby-2.2.5 - #downloading rubygems-2.4.8 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 437k 100 437k 0 0 226k 0 0:00:01 0:00:01 --:--:-- 1625k ruby-2.2.5 - #extracting rubygems-2.4.8.... ruby-2.2.5 - #removing old rubygems......... ruby-2.2.5 - #installing rubygems-2.4.8...................... ruby-2.2.5 - #gemset created /usr/local/rvm/gems/ruby-2.2.5@global ruby-2.2.5 - #importing gemset /usr/local/rvm/gemsets/global.gems............................................... ruby-2.2.5 - #generating global wrappers........ ruby-2.2.5 - #gemset created /usr/local/rvm/gems/ruby-2.2.5 ruby-2.2.5 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list ruby-2.2.5 - #generating default wrappers........ ruby-2.2.5 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.2.5 - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# rvm use ruby-2.2.5 --default Using /usr/local/rvm/gems/ruby-2.2.5 [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# gem install nokogiri Fetching: pkg-config-1.1.7.gem (100%) Successfully installed pkg-config-1.1.7 Fetching: mini_portile2-2.1.0.gem (100%) Successfully installed mini_portile2-2.1.0 Fetching: nokogiri-1.6.8.gem (100%) Building native extensions. This could take a while... Successfully installed nokogiri-1.6.8 Parsing documentation for pkg-config-1.1.7 Installing ri documentation for pkg-config-1.1.7 Parsing documentation for mini_portile2-2.1.0 Installing ri documentation for mini_portile2-2.1.0 Parsing documentation for nokogiri-1.6.8 Installing ri documentation for nokogiri-1.6.8 Done installing documentation for pkg-config, mini_portile2, nokogiri after 8 seconds 3 gems installed [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# gem install log4r Fetching: log4r-1.1.10.gem (100%) Successfully installed log4r-1.1.10 Parsing documentation for log4r-1.1.10 Installing ri documentation for log4r-1.1.10 Done installing documentation for log4r after 0 seconds 1 gem installed [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# . /home/db2inst1/sqllib/db2profile [root@simbad ~]# export IBM_DB_HOME=/opt/ibm/db2/V10.5/ [root@simbad ~]# gem install ibm_db Fetching: arel-7.0.0.gem (100%) Successfully installed arel-7.0.0 Fetching: concurrent-ruby-1.0.2.gem (100%) Successfully installed concurrent-ruby-1.0.2 Fetching: thread_safe-0.3.5.gem (100%) Successfully installed thread_safe-0.3.5 Fetching: tzinfo-1.2.2.gem (100%) Successfully installed tzinfo-1.2.2 Fetching: i18n-0.7.0.gem (100%) Successfully installed i18n-0.7.0 Fetching: activesupport-5.0.0.gem (100%) Successfully installed activesupport-5.0.0 Fetching: activemodel-5.0.0.gem (100%) Successfully installed activemodel-5.0.0 Fetching: activerecord-5.0.0.gem (100%) Successfully installed activerecord-5.0.0 Fetching: ibm_db-3.0.4.gem (100%) Building native extensions. This could take a while...


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). Your use of the components of the package and dependencies constitutes your acceptance of their respective license agreements. If you do not accept the terms of any license agreement(s), then delete the relevant component(s) from your system/device.


Successfully installed ibm_db-3.0.4 Parsing documentation for arel-7.0.0 Installing ri documentation for arel-7.0.0 Parsing documentation for concurrent-ruby-1.0.2 Installing ri documentation for concurrent-ruby-1.0.2 Parsing documentation for thread_safe-0.3.5 Installing ri documentation for thread_safe-0.3.5 Parsing documentation for tzinfo-1.2.2 Installing ri documentation for tzinfo-1.2.2 Parsing documentation for i18n-0.7.0 Installing ri documentation for i18n-0.7.0 Parsing documentation for activesupport-5.0.0 Installing ri documentation for activesupport-5.0.0 Parsing documentation for activemodel-5.0.0 Installing ri documentation for activemodel-5.0.0 Parsing documentation for activerecord-5.0.0 Installing ri documentation for activerecord-5.0.0 Parsing documentation for ibm_db-3.0.4 Installing ri documentation for ibm_db-3.0.4 Done installing documentation for arel, concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, activemodel, activerecord, ibm_db after 45 seconds 9 gems installed [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","CORRECTPW") => # 2.2.5 :003 > IBM_DB.close(conn) => true 2.2.5 :004 > conn = IBM_DB.connect("SIMBADB","simbadba","WRONGPW") ^C^C^C^CKilled [root@simbad ~]# [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","CORRECTPW") => # 2.2.5 :003 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.SEQ_LOG_EXECUCAO_BACKUP") => # 2.2.5 :004 > row = IBM_DB.fetch_array(stmt) => [1] 2.2.5 :005 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.SEQ_LOG_EXECUCAO_BACKUP") => # 2.2.5 :006 > row = IBM_DB.fetch_array(stmt) => [2] 2.2.5 :007 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.SEQ_LOG_EXECUCAO_BACKUP") => # 2.2.5 :008 > row = IBM_DB.fetch_array(stmt) => [3] 2.2.5 :009 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.WRONG_TABLE") => false 2.2.5 :010 > IBM_DB.getErrormsg(conn, IBM_DB::DB_CONN) => "[IBM][CLI Driver][DB2/LINUXZ64] SQL0204N \"SIMBA.WRONG_TABLE\" is an undefined name. SQLSTATE=42704 SQLCODE=-204" 2.2.5 :011 > IBM_DB.close(conn) => true 2.2.5 :012 > conn = IBM_DB.connect("WRONG","simbadba","CORRECTPW") UncaughtThrowError: uncaught throw :"Connection failed: [IBM][CLI Driver] SQL1013N The database alias name or database name \"WRONG\" could not be found. SQLSTATE=42705 SQLCODE=-1013" from (irb):12:in connect' from (irb):12 from /usr/local/rvm/rubies/ruby-2.2.5/bin/irb:11:in

' 2.2.5 :013 > conn = IBM_DB.connect("SIMBADB","simbadba","WRONGPW") UncaughtThrowError: uncaught throw :"Connection failed: [IBM][CLI Driver] SQL30082N Security processing failed with reason \"24\" (\"USERNAME AND/OR PASSWORD INVALID\"). SQLSTATE=08001 SQLCODE=-30082" from (irb):13:in connect' from (irb):13 from /usr/local/rvm/rubies/ruby-2.2.5/bin/irb:11:in
' 2.2.5 :014 > quit [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","WRONGPW") Killed [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","WRONGPW") Killed [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","WRONGPW") Killed [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","CORRECTPW") => # 2.2.5 :003 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.SEQ_LOG_EXECUCAO_BACKUP") => # 2.2.5 :004 > row = IBM_DB.fetch_array(stmt) => [4] 2.2.5 :005 > IBM_DB.close(conn) => true 2.2.5 :006 > conn = IBM_DB.connect("SIMBADB","simbadba","CORRECTPW") => # 2.2.5 :007 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.WRONG_TABLE") => false 2.2.5 :008 > IBM_DB.getErrormsg(conn, IBM_DB::DB_CONN) => "[IBM][CLI Driver][DB2/LINUXZ64] SQL0204N \"SIMBA.WRONG_TABLE\" is an undefined name. SQLSTATE=42704 SQLCODE=-204" 2.2.5 :009 > IBM_DB.close(conn) => true 2.2.5 :010 > conn = IBM_DB.connect("WRONG","simbadba","CORRECTPW") UncaughtThrowError: uncaught throw :"Connection failed: [IBM][CLI Driver] SQL1013N The database alias name or database name \"WRONG\" could not be found. SQLSTATE=42705 SQLCODE=-1013" from (irb):10:in connect' from (irb):10 from /usr/local/rvm/rubies/ruby-2.2.5/bin/irb:11:in
' 2.2.5 :011 > quit [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("WRONG","simbadba","WRONGPW") Killed [root@simbad ~]# [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("WRONG","simbadba","CORRECTPW") Killed [root@simbad ~]# irb 2.2.5 :001 > require 'ibm_db' => true 2.2.5 :002 > conn = IBM_DB.connect("SIMBADB","simbadba","CORRECTPW") => # 2.2.5 :003 > stmt=IBM_DB.exec(conn, "VALUES NEXT VALUE FOR SIMBA.WRONG_TABLE") => false 2.2.5 :004 > IBM_DB.getErrormsg(conn, IBM_DB::DB_CONN) => "[IBM][CLI Driver][DB2/LINUXZ64] SQL0204N \"SIMBA.WRONG_TABLE\" is an undefined name. SQLSTATE=42704 SQLCODE=-204" 2.2.5 :005 > IBM_DB.close(conn) => true 2.2.5 :006 > quit [root@simbad ~]# [root@simbad ~]# [root@simbad ~]#

On Wed, Jul 13, 2016 at 10:24 AM, Arvind Gupta notifications@github.com wrote:

We have several times tried to reproduce this problem, however we could not reproduce. As @finalstep https://github.com/finalstep mentioned that the problem went away after upgrading to 3.0.1. Please note we have not fixed this problem in version 3.0.1. @ronaldoqueiroz https://github.com/ronaldoqueiroz Are you facing this problem in OS X or Linux or both? If you have not tried, can you please try reinstalling ibm_db gem.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ibmdb/ruby-ibmdb/issues/43#issuecomment-232353383, or mute the thread https://github.com/notifications/unsubscribe/ATevC545tiLNbgWC2JXMiQldeJIaanxSks5qVOb8gaJpZM4GP344 .

akhilravuri1 commented 4 years ago

Hi @finalstep we have released a new version in the ibm_db driver which supports till 2.6.5 and rails v6. Please update the driver. Thanks, Akhil