ibmdb / ruby-ibmdb

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

Connection hangs when connecting to DB2 #60

Closed bbozo closed 6 years ago

bbozo commented 8 years ago

Dear all,

we are using the sequel gem to connect to a DB2 instance (v10.5 FP5). When we try to connect (either by executing a test select statement in sequel or running IBM_DB.connect directly) the connection hangs in a way that only kill -9 resolves.

Since IBM_DB.connect fails in the exactly same way as the Sequel.select when ibm_db is in use, I'm assuming that it's the same problem.

The connection works with same parameters using the JDBC driver under JRuby, here's the reproducing code: https://gist.github.com/bbozo/df9f5992e777b64984c22f67106e366b

I have tried figuring out if I'm doing something wrong and make sure that the tests pass on ruby-2.2.4, but the adapter tests return:

rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.

and the driver tests (what is the difference btw? :)) return:

bbozo@eva:~/dev/ruby-ibmdb/IBM_DB_Driver (master) $ rake
/home/bbozo/.rvm/rubies/ruby-2.2.3/bin/ruby 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
/home/bbozo/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/open-uri.rb:36:in `initialize': No such file or directory @ rb_sysopen - /home/bbozo/dev/ruby-ibmdb/IBM_DB_Driver/../lib/clidriver.tar.gz (Errno::ENOENT)
        from /home/bbozo/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/open-uri.rb:36:in `open'
        from /home/bbozo/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/open-uri.rb:36:in `open'
        from extconf.rb:117:in `downloadCLIPackage'
        from extconf.rb:160:in `<main>'
rake aborted!
Command failed with status (1): [/home/bbozo/.rvm/rubies/ruby-2.2.3/bin/rub...]
/home/bbozo/dev/ruby-ibmdb/IBM_DB_Driver/Rakefile:15:in `block in <top (required)>'
/home/bbozo/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bbozo/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => default => test => lib => ibm_db.so => extconf => Makefile
(See full trace by running task with --trace)

I'm unsure how to proceed so please advise.

PS we're probably also affected by #31 and #45 as we use Postgres as main database and DB2 as archive database, is there a time plan for those so we know if C ruby is an option given project schedule?

arvindgu commented 8 years ago

Can you check if you have firewall enabled, if yes then please allow http://public.dhe.ibm.com.

bbozo commented 8 years ago

@arvindgu my development machine can access all public HTTP addresses including that one, and the connection parameters work for sure because the connection works with JDBC (see the gist in the OP), should the DB2 server also have access to the above mentioned IP?

arvindgu commented 8 years ago

The ibm_db gem auto-downloads the required CLI package and unzip it while ibm_db gem installation.

bbozo@eva:~/dev/ruby-ibmdb/IBM_DB_Driver (master) $ rake /home/bbozo/.rvm/rubies/ruby-2.2.3/bin/ruby extconf.rb

I see you are running above command. When ibm_db gem is already installed, then you should not run ibm_db gem extconf.rb file. Is there any specific reason for running this?

I need db2 traces for hang issue with ibm_db gem. Please refer instructions for collecting db2 traces mentioned in issue #43. Also check whether #43 is applicable in your case.

bbozo commented 8 years ago

@arvindgu the core issue is that the connection attempts hangs, the issue with extconf.rb relates to my attempts to run the tests :)

43 doesn't seem to apply as the DB2 connection is up - this is tested using JDBC under JRuby - and I use ibm_db (3.0.1) which has that issue fixed.

Also, in my case the loading of the gem goes fine

2.2.4 :001 > require 'ibm_db'
 => true 

Fortunately, we know that the JDBC driver connects fine, so it seems that the DB2 server is up as it should be and that network etc is OK. Could you please check out THIS GIST and see if I do anything wrong with building the DSN or using it in IBM_DB.connect ?

arvindgu commented 8 years ago

I see you are connecting to IBM AS400 machine. Hence you need to copy DB2Connect license to ibm_db_gem_install_dir/lib/clidriver/license directory. After this the connection should work.

bbozo commented 8 years ago

@arvindgu DB2Connect license? :D first news, can you help? where can I find that?

arvindgu commented 8 years ago

As you mentioned that using JDBC driver under JRuby works. Are you using IBM DB2 JCC driver?

bbozo commented 8 years ago

@arvindgu I'm using jt400.jar for connecting with JDBC, but the connection from SQLDeveloper using db2jcc.jar & db2jcc_license_cu.jar doesn't work (connection hangs), do you think it's also a licensing issue?

Do you have any suggestion regarding using the ODBC driver under YARV Ruby and CentOS versus the IBM_DB ruby driver, is ODBC a viable alternative in this case?

Also, should the documentation be updated to say that connecting to AS400 requires an extra paid license or the connection hangs? :)

arvindgu commented 6 years ago

Our current ruby driver works with ODBC driver, and I hope you would have tried with it, Hence closing.

sterankin commented 4 years ago

@bbozo did you ever really resolve this. I'm having the exact same issue. I'm not using java, im using the ibm_db gem and the connection hangs when trying to connect to IBM as400.

bbozo commented 4 years ago

@sterankin there's a lot of years now between then and now and I don't know how IBM stands with NDAs regarding communication with their tech support and sales - but I'm assuming they're on the evil side about it together with Oracle.

Long story short: I'm guessing you'll have to talk with IBM - I wish you better luck than mine about it

sterankin commented 4 years ago

Thanks - I am reading that I might need a db2 connect license somewhere, so I am following that line of enquiry. Just was checking if this was your solution or not as this issue was closed without real resolution.


From: bbozo notifications@github.com Sent: Monday, November 18, 2019 7:02:03 PM To: ibmdb/ruby-ibmdb ruby-ibmdb@noreply.github.com Cc: sterankin sterankin@hotmail.com; Mention mention@noreply.github.com Subject: Re: [ibmdb/ruby-ibmdb] Connection hangs when connecting to DB2 (#60)

@sterankinhttps://github.com/sterankin there's a lot of years now between then and now and I don't know how IBM stands with NDAs regarding communication with their tech support - but I'm assuming they're on the evil side about it together with Oracle.

Long story short: I'm guessing you'll have to talk with IBM - I wish you better luck than mine about it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ibmdb/ruby-ibmdb/issues/60?email_source=notifications&email_token=ACXE4NYDUN3SPXAOZB3QJPLQULRCXA5CNFSM4CD2GSB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELRIMA#issuecomment-555160624, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACXE4N6T5IOAPSGNSI6ZCM3QULRCXANCNFSM4CD2GSBQ.

bbozo commented 4 years ago

Thanks - I am reading that I might need a db2 connect license somewhere, so I am following that line of enquiry. Just was checking if this was your solution or not as this issue was closed without real resolution.

Same here

sterankin commented 4 years ago

Thanks - I am reading that I might need a db2 connect license somewhere, so I am following that line of enquiry. Just was checking if this was your solution or not as this issue was closed without real resolution.

Same here

So did you actually solve it with help from IBM? I have contacted them for support, anyhelp you can provide would be useful.

bbozo commented 4 years ago

So did you actually solve it with help from IBM? I have contacted them for support, anyhelp you can provide would be useful.

I think they asked the client to take the DB2 Connect license, at that point the Cc list changed :-) and I never heard about it again