Arjdbc connection bug? (beta2)

Hello,

Using the tip of nickieger’s git tree with DB2 on Linux…

Seems the first time a test env tries to access the database it doesn’t
work anymore. Symptom is running “rake test” skips unit tests altogether
and goes straight into functional testing. And if I run “rake
test:units”, I get this:

$ jruby -S rake test:units --trace
(in xxxxxxxxxxx)
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
rake aborted!
no connection available
/home/kreucher/.gem/jruby/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta2-java/lib/arjdbc/db2/adapter.rb:212:in
`recreate_database’
/home/kreucher/.gem/jruby/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta2-java/lib/arjdbc/jdbc/jdbc.rake:121
.
.
.

I did a bisect and found the commit that broke it:

    8b4b9c597253f35873e6b621104d8c47923e1508 is the first bad commit
    commit 8b4b9c597253f35873e6b621104d8c47923e1508
    Author: Nick S. <[email protected]>
    Date: Fri Sep 24 12:49:59 2010 -0500

    JRUBY-5081: Consolidate code for dropping DB via postgres

    :040000 040000 24d585e67628f5a7e83922e0f73c1cb0fa59114a
    f46150f236c3144cbe66df649d243bad313e5b8c M lib

Looks like this moved some database connection stuff around… thought
I’d post here before digging in too deep. Nick S., any ideas? :slight_smile:

Thanks!
- nick

Nick,

I don’t have DB2, can you find a patch that makes it work again and
send it over?

/Nick

Hi Nick,

Well, this gist fixes it (it’s not in my git tree):
http://gist.github.com/626746

…which is pretty shocking and suggests there might be some
optimization(?) problem with JRuby. I made sure it wasn’t a timing issue
by inserting a sleep in the DB2::recreate_database method, didn’t make
any difference.

A curious fact is the DB2 recreate_database method doesn’t do anything
with the passed in database name (since the db connection is always to a
specific database to begin with). I wonder if other similar databases
(Oracle comes to mind) would trigger this problem as well?

Also (unrelated) I have a better fix for the old DB2 integer :limit
problem; it resolves an edge case failing. From my git tree (I merged
w/you this morning):
http://github.com/kreucher/activerecord-jdbc-adapter/commit/4cce13ff0d83a6a467e10dab25155ce63a33fb05

Hope there is still time to slip these into 1.0.0.

Thanks!
- nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs