Re: how does AR-jdbc adapter hook into AR?

  • From: Jay McGaffigan <hooligan495@gmail.com>
  • To: "dev@activerecord-jdbc.kenai.com" <dev@activerecord-jdbc.kenai.com>
  • Cc: "dev@activerecord-jdbc.kenai.com" <dev@activerecord-jdbc.kenai.com>
  • Subject: Re: how does AR-jdbc adapter hook into AR?
  • Date: Tue, 28 Apr 2009 17:37:53 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:x-mailer:mime-version:subject:date:cc; b=GkpRLR16UV7hY+avH5nJDMOwUHWWXJhsZKP6+MXqp8SKEIAYFn8tCL8/HH4hScYTLg w6SGyFuad2zuIxf18/2etRcMWMxctWNz4APkt+6SxqMxgqaVlSKC5C29fOWXKyChwGwu 9er8ozeAjGCspGieFSxeZ2ZXElCD6IIQmG88U=

Actually. If I put the fix into an embedded ruby tag in the yml things work. Doing that feels ok to me. I have to test other rake tasks to make sure everything gets covered

Jay


On Apr 28, 2009, at 2:25 PM, Nick Sieger <nicksieger@gmail.com> wrote:

Whoops. Indeed. Let me know if you see a workaround.

/Nick

On Tue, Apr 28, 2009 at 1:04 PM, Jay McGaffigan <hooligan495@gmail.com> wrote:
hi.

I'm sure these fixes would work fine except that calling rake
db:create:all doesn't appear to load the environment.rb file at all.

This makes it harder to fix this issue.

Jay

On Tue, Apr 28, 2009 at 1:15 PM, Nick Sieger <nicksieger@gmail.com> wrote:
On Tue, Apr 28, 2009 at 10:43 AM, Nick Sieger <nicksieger@gmail.com> wrote:
On Mon, Apr 27, 2009 at 9:58 PM, Jay McGaffigan <hooligan495@gmail.com > wrote:
I am trying to track down an issue I'm seeing with Jruby 1.2 and Rails
2.3.2 where when you call rake db:create:all only 2 out of the 3
databases in the database yml file are being created.

I've tracked it down to a loading problem. it looks like the aliasing
of the create_database call in the rake tasks is being done too late.
but I'm trying to find where it's supposed to happen. Could anyone
help me find the main entry point of where the adapter is supposed to
"hook" itself in to the db:create:all stack?  I'm working my way
backwards but would like to shortcut that process if possible

Depends on how you've wired up ar-jdbc, but most of the time if you've
done it by just specifying "jdbcmysql" in database.yml, it probably
does get loaded too late. The place you're looking for is
AR::Base.establish_connection in
activerecord/lib/active_record/connection_adapters/abstract/ connection_specification.rb.

It looks like the workaround in this case is to hard-code an eager
loading of the adapter in environment.rb, as shown in step 2 of:

http://kenai.com/projects/activerecord-jdbc/pages/Home#Inside_Rails

It appears another workaround you can try is to specify to have the
gem loaded in environment.rb as follows:

config.gem "activerecord-jdbcmysql-adapter", :lib =>
"active_record/connection_adapters/jdbcmysql_adapter"

/Nick




how does AR-jdbc adapter hook into AR?

Jay McGaffigan 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Nick Sieger 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Nick Sieger 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Thomas Enebo 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Jay McGaffigan 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Thomas Enebo 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Jay McGaffigan 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Nick Sieger 04/28/2009

Re: how does AR-jdbc adapter hook into AR?

Jay McGaffigan 04/28/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close