Re: using ActiveRecord-jdbcmysql-adapter and rake db:drop:all doesn't work

Hi Nick,

I got past my original problem but have stumbled accross something else.

I have ActiveRecord-jdbcmysql-adapter installed.
I have rails 2.1

I followed this little tutorial:

http://blog.emptyway.com/2008/04/08/120-seconds-guide-to-jruby-on-rails/

And created a test website. (I am using jruby 1.1.2 atm)

jruby -S rails -d mysql test

The yml file that’s created has entries like :
development:
adapter: mysql
encoding: utf8
database: test_development
username: root
password:
host: localhost

so I changed it to reflect what I’ve been told:
development:
adapter: jdbcmysql
encoding: utf8
database: test_development
username: root
password:

I do a jruby -S rake db:create:all and my dbs are created.
I do a jruby -S rake db:drop:all and I don’t get any error messages, so
it appears like the command succeeded but when I goto mysql I still see
my databases.

It’s almost like … if there is an error or exception… it’s getting
consumed and rake thinks all is good. but it isn’t. Is there any way
to turn any type of logging on in the Active record adapter at teh java
level? (my rails log file has nothing added to it when I do a rake
db:drop:all)

even wierder… if I do a jruby -S rake db:drop… it works as
expected… the test_development db got dropped.

In addition to trying to figure this out… I’m also (on a separate
machine) trying to get rcov4jr working and I see a similar oddity where
when we run RCov(with the java ext) on a rails unit test … the unit
test reports it’s successes and failures however no rcov results get
generated… again it’s almost like there is an error somewhere that’s
being consumed.

But let’s focus on the db:drop:all stuff for now. Has anyone else seen
this behavior?

Jay

On Tue, Jul 15, 2008 at 1:04 PM, Jay McGaffigan
[email protected] wrote:

development:
encoding: utf8
turn any type of logging on in the Active record adapter at teh java level?
(my rails log file has nothing added to it when I do a rake db:drop:all)
even wierder… if I do a jruby -S rake db:drop… it works as expected…
the test_development db got dropped.
In addition to trying to figure this out… I’m also (on a separate machine)
trying to get rcov4jr working and I see a similar oddity where when we run
RCov(with the java ext) on a rails unit test … the unit test reports it’s
successes and failures however no rcov results get generated… again it’s
almost like there is an error somewhere that’s being consumed.
But let’s focus on the db:drop:all stuff for now. Has anyone else seen this
behavior?

I think the rake db:create and db:drop tasks don’t work very well
right now when you have adapter: jdbc*, because if you look in Rails’
databases.rake file there are case statements that match the adapter
name exactly.

This patch (http://dev.rubyonrails.org/ticket/11596) is a start at
making that better, but we need to refresh it and get it in Lighthouse
and pushed through.

Otherwise, your best bet is to use adapter: mysql and put a snippet
like the following above the Rails initializer in environment.rb:

if defined?(JRUBY_VERSION)
require ‘rubygems’
gem ‘activerecord-jdbcmysql-adapter’
require ‘active_record/connection_adapters/jdbcmysql_adapter’
end

Cheers,
/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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