[ANN] activerecord-jdbc-adapter 0.9.2

Hi all,

Just pushed the new activerecord-jdbc-adapter 0.9.2 release. It brings
compatibility up to a new level, works with JRuby trunk and the
soon-to-be-released JRuby 1.4, and many other fixes ( issues fixed in
total).

The main new feature introduced is a new “jdbc” rails generator to
create files that bootstrap the JDBC adapter in your Rails environment
and when running Rake. Just install the gem as usual:

$ jruby -S gem install activerecord-jdbc-adapter
Successfully installed activerecord-jdbc-adapter-0.9.2
1 gem installed

Then run the generator:

$ jruby script/generate jdbc
exists config/initializers
create config/initializers/jdbc.rb
exists lib/tasks
create lib/tasks/jdbc.rake

The big upside of this new feature is that you no longer have to
change database.yml at all! You can simply use the default content
that Rails gives you when you generate an application. Also, these
jdbc files are only loaded when running under JRuby, so they won’t
take effect under C Ruby.

Note: the jdbc.rb initializer depends on no database connection having
been established to work properly. If you run queries in your
initializer scripts, you’ll need to ensure that the contents of
jdbc.rb run before them.

I’d also like to thank and welcome a host of new contributors for this
release (and the database support they helped improve):

  • Christian S.
  • Jean-Dominique Morani
  • Christopher Saunders (Derby)
  • David K. (Postgres)
  • Nick Zalabak (MySQL)
  • Ryan Baumann (SQLite3)
  • Ben B. (Oracle)
  • Jens Himmelreich (Oracle)
  • Dan Powell (Oracle)
  • Marcelo Murad (Oracle)
  • Mike L. (MSSql)
  • Amos K. (DB2)

Please try the new gem with your applications and provide feedback!
Send bug reports to http://kenai.com/jira/browse/ACTIVERECORD_JDBC.

Enjoy!
/Nick

Full release history:

== 0.9.2

  • The main, highly awaited fix for this release is a solution to the
    rake db:create/db:drop issue. The main change is a new ‘jdbc’ rails
    generator that should be run once to prepare a Rails application to
    use JDBC. The upside of this generator is that you no longer will
    need to alter database.yml for JDBC. See the README.txt for details.
  • Cleanup and reconnect if errors occur during begin/rollback
    (Jean-Dominique Morani, Christian S.)
  • ACTIVERECORD_JDBC-1: Add #drop_database method for oracle (does the
    same thing as recreate_database)
  • Sqlite3 and MSSQL fixes (Jean-Dominique Morani)
  • JRUBY-3512: Treat LONGVARCHAR as a CLOB for Mssql
  • JRUBY-3624: Upgrade Derby to 10.5.3.0 and add native limit/offset
    support (Christopher Saunders)
  • JRUBY-3616: Fix postgres non-sequence primary keys (David K.)
  • JRUBY-3669: Fix Oracle case with unconfigured schema (Dan Powell)
  • Fixed quote_column_name of jdbc_oracle to accept numbers (Marcelo
    Murad)
  • Fix for mysql tables with non standard primary keys such that the
    schema dump is correct (Nick Zalabak)
  • MSSQL fixes from Mike L.:
    • add support for MSSQL uniqueidentifier datatype
    • always quote strings using unicode identifier for MSSQL
  • Changes primary_key generation to use always instead of by default
    for DB2 (Amos K.)
  • Improves the SQLite adapter by fixing rename_column, change_column,
    change_column_default, changing remove_column, and adding
    remove_columns (Ryan Baumann)
  • More oracle love courtesy Ben B. and Jens Himmelreich
  • JRUBY-3608: Add missing change_column_null method for postgres
  • JRUBY-3508: Fix quoting of integer and float columns

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Fri, Oct 2, 2009 at 5:23 PM, Nick S. [email protected]
wrote:

soon-to-be-released JRuby 1.4, and many other fixes ( issues fixed in
total).

This should “(20 issues fixed in total)”.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Take a look at application templates as a lighter way to create the
task and initializer.

Bob

Sent from my iPhone

On Oct 2, 2009, at 6:23 PM, Nick S. [email protected] wrote:

 create  lib/tasks/jdbc.rake

jdbc.rb run before them.

  • Ben B. (Oracle)
    /Nick
  • Cleanup and reconnect if errors occur during begin/rollback
    Murad)
  • More oracle love courtesy Ben B. and Jens Himmelreich
  • JRUBY-3608: Add missing change_column_null method for postgres
  • JRUBY-3508: Fix quoting of integer and float columns

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

At 5:23 PM -0500 10/2/09, Nick S. wrote:

== 0.9.2

  • The main, highly awaited fix for this release is a solution to the
    rake db:create/db:drop issue. The main change is a new ‘jdbc’ rails
    generator that should be run once to prepare a Rails application to
    use JDBC. The upside of this generator is that you no longer will
    need to alter database.yml for JDBC. See the README.txt for details.

Hi Nick,

I use the following form in my database.yml config:

adapter: <% if RUBY_PLATFORM =~ /java/ %>jdbcmysql<% else %>mysql<%
end %>

And I’ve made the following patches to my vendored 2.3.4 rails to get
db:drop and db:create to work with jdbcmysql:

diff --git a/vendor/rails/railties/lib/tasks/databases.rake
b/vendor/rails/railties/lib/tasks/databases.rake
index 8b60839…faf4f0b 100644
— a/vendor/rails/railties/lib/tasks/databases.rake
+++ b/vendor/rails/railties/lib/tasks/databases.rake
@@ -53,7 +53,7 @@ namespace :db do
end
rescue
case config[‘adapter’]

  •  when 'mysql'
    
  •  when /mysql/
       @charset   = ENV['CHARSET']   || 'utf8'
       @collation = ENV['COLLATION'] || 'utf8_unicode_ci'
       begin
    

@@ -411,7 +411,7 @@ end

def drop_database(config)
case config[‘adapter’]

  • when ‘mysql’
  • when /mysql/
    ActiveRecord::Base.establish_connection(config)
    ActiveRecord::Base.connection.drop_database config[‘database’]
    when /^sqlite/

Did you add any dependencies in 0.9.2 that rely on or require running:
jruby script/generate jdbc ??


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Oct 13, 2009 at 12:55 AM, Stephen B.
[email protected] wrote:

rails_2_3_3
This is a large regression from the last time I ran these tests in January:

jdbcmysql: 1807 tests, 6004 assertions, 20 failures, 1 errors

see: https://rails.lighthouseapp.com/projects/8994/tickets/1685-adding-ar-test-connections-for-jdbc-via-jruby

Are you getting different/better results when you run the rails active_record tests?

I haven’t tried lately, but I’m not surprised. Were the previous
results with Rails 2.2? I’d expect some of the regressions to come
from changes in Rails, but I’m also not above taking blame for them
being regressions in AR-JDBC. Getting regular runs of ActiveRecord
tests for edge + 1-2 recent releases is something I’d like to get
going soon.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

At 5:23 PM -0500 10/2/09, Nick S. wrote:

Hi all,

Just pushed the new activerecord-jdbc-adapter 0.9.2 release. It brings
compatibility up to a new level, works with JRuby trunk and the
soon-to-be-released JRuby 1.4, and many other fixes ( issues fixed in
total).

Hi Nick,

When I run the tests against various versions of recent rails I’m
getting many errors and failures:

rails_2_3_stable
2105 tests, 6572 assertions, 64 failures, 95 errors

rails_2_3_4
2070 tests, 6508 assertions, 64 failures, 86 errors

rails_2_3_3
2042 tests, 6428 assertions, 62 failures, 90 errors

I’m running the tests in master (03feb70009befdfa …) activerecord_jdbc
with this command:

$ jruby -S rake rails:test DRIVER=mysql RAILS=$RAILS_SOURCE

I’m using master jruby-1_4 (0d128f9c445d9b002…).

Here the output testing against rails_2_3_4:
http://gist.github.com/209034

This is a large regression from the last time I ran these tests in
January:

jdbcmysql: 1807 tests, 6004 assertions, 20 failures, 1 errors

see:
https://rails.lighthouseapp.com/projects/8994/tickets/1685-adding-ar-test-connections-for-jdbc-via-jruby

Are you getting different/better results when you run the rails
active_record tests?


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

At 2:06 PM -0500 10/13/09, Nick S. wrote:

2070 tests, 6508 assertions, 64 failures, 86 errors
Here the output testing against rails_2_3_4: http://gist.github.com/209034
results with Rails 2.2? I’d expect some of the regressions to come
from changes in Rails, but I’m also not above taking blame for them
being regressions in AR-JDBC. Getting regular runs of ActiveRecord
tests for edge + 1-2 recent releases is something I’d like to get
going soon.

My patch for rails to enable running the jdbc tests got in in 2.2.3.
When I run the tests on that version of active_record I get fewer
errors.

v2.2.3: 1690 tests, 5797 assertions, 55 failures, 1 errors

I’ll take a look at what the differences are due to. There are about
2-300 new tests in active_record.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

At 4:30 PM -0400 10/13/09, Stephen B. wrote:

rails_2_3_4
2070 tests, 6508 assertions, 64 failures, 86 errors

Installing mocha:

$ jruby -S gem install mocha

got rid of 84 out of 85 errors.

rails2.3.4: 2070 tests, 6630 assertions, 64 failures, 1 errors

Here’s the last error – seems like a text column can’t have a default
value.

  1. Error:
    test_create_table_with_defaults(MigrationTest):
    ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError:
    BLOB/TEXT column ‘five’ can’t have a default value: CREATE TABLE
    testings (id int(11) DEFAULT NULL auto_increment PRIMARY KEY, one
    varchar(255) DEFAULT ‘hello’, two tinyint(1) DEFAULT 1, three
    tinyint(1) DEFAULT 0, four integer(10) DEFAULT 1, five text DEFAULT
    ‘hello’) ENGINE=InnoDB CHARACTER SET utf8
    /Users/stephen/dev/ruby/src/gems/rails-git/activerecord/test/cases/…/…/lib/active_record/connection_adapters/abstract_adapter.rb:219:in
    log' /Users/stephen/dev/ruby/src/gems/activerecord-jdbc-adapter.git/lib/active_record/connection_adapters/jdbc_adapter.rb:559:inexecute’
    /Users/stephen/dev/ruby/src/gems/rails-git/activerecord/test/cases/helper.rb:36:in
    execute_with_query_record' /Users/stephen/dev/ruby/src/gems/rails-git/activerecord/test/cases/../../lib/active_record/connection_adapters/abstract/schema_statements.rb:114:increate_table’
    /Users/stephen/dev/ruby/src/gems/activerecord-jdbc-adapter.git/lib/jdbc_adapter/jdbc_mysql.rb:174:in
    create_table' ./test/cases/migration_test.rb:167:intest_create_table_with_defaults’
    /Users/stephen/dev/ruby/src/gems/rails-git/activerecord/test/cases/…/…/…/activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in
    `run’

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Oct 13, 2009 at 1:02 AM, Stephen B.
[email protected] wrote:

index 8b60839…faf4f0b 100644
begin
Did you add any dependencies in 0.9.2 that rely on or require running: jruby script/generate jdbc ??
No, the “jdbc*” adapter name should still work. It’s good to know that
you were able to get the db:create and db:drop to work with those
simple changes; maybe I’ll advocate for getting those changes made to
Rails so that future versions of AR-JDBC don’t need to monkeypatch the
rakefile so much.

/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