jdbc-adapter doesn't work with Rails 3 RC2?

  6 posts   Feedicon  
Replies: 5 - Last Post: October 07, 2010 01:25
by: arkadiyk
showing 1 - 6 of 6
Posted: August 28, 2010 01:08 by arkadiyk
Hi, after upgrading Rails 3 to RC2 jdbc-adapter stopped working. Rails doesn't see any tables in the DB.

I upgraded jdbc-adapter to 1.0.0.beta1 but it didn't help.

irb(main):001:0> User.first
ActiveRecord::JDBCError: Table  does not exist
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta1-java/lib/arjdbc/jdbc/adapter.rb:189:in `jdbc_columns'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta1-java/lib/arjdbc/mssql/adapter.rb:327:in `columns'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta1-java/lib/arjdbc/mssql/adapter.rb:447:in `determine_primary_key'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta1-java/lib/arjdbc/mssql/adapter.rb:443:in `determine_order_clause'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.0.0.beta1-java/lib/arjdbc/mssql/adapter.rb:222:in `add_limit_offset!'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/arel-1.0.0.rc1/lib/arel/engines/sql/relations/compiler.rb:50:in `build_clauses'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/arel-1.0.0.rc1/lib/arel/engines/sql/relations/compiler.rb:26:in `select_sql'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/arel-1.0.0.rc1/lib/arel/algebra/relations/relation.rb:42:in `to_sql'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0.rc2/lib/active_record/relation.rb:64:in `to_a'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0.rc2/lib/active_record/relation/finder_methods.rb:333:in `find_first'
        from d:/sw/jruby-1.5.2/lib/ruby/gems/1.8/gems/activerecord-3.0.0.rc2/lib/active_record/relation/finder_methods.rb:122:in `first'
        from d:0:in `first'
        from (irb):1
Posted: September 02, 2010 18:58 by Nick Sieger
Stocksoftware's fork may have some of these fixes.


I'll try to fix for 1.0.0, can you file a bug in JIRA?


Posted: September 01, 2010 15:23 by scottned
I'm having the same problem. It looks like it's a bug in the SQL Server adapter related to handling models with a non-interpolated table name (i.e. the model uses set_table_name). There could be a problem with set_primary_key also.

Incidentally, Widget.count works fine, but Widget.first or Widget.find(123) does not.

Posted: September 24, 2010 15:02 by Nick Sieger
This is fixed for 1.0.0 and there will be a 1.0.0.beta2 out shortly.
Posted: September 30, 2010 03:23 by arkadiyk
I haven't try to test it yet, but looking at the code it looks like it fixed partially and only for MS SQL. Partially because calls like User.limit(10).count probably will not work without patching the count part of select_sql method in Arel::SqlCompiler::GenericCompiler.

Posted: October 07, 2010 01:25 by arkadiyk
It didn't work indeed:

User.limit(10).count gives the following error:

ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: No column was specified for column 1 of 'subquery'.: SELECT t.* FROM (SELECT ROW_NUMBER() OVER(ORDER BY Users.UserID) AS _row_num, COUNT(*) AS count_id FROM (SELECT 1 FROM Users ) AS subquery) AS t WHERE t._row_num BETWEEN 1 AND 10
showing 1 - 6 of 6
Replies: 5 - Last Post: October 07, 2010 01:25
by: arkadiyk
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2014, Oracle Corporation and/or its affiliates
(revision 20160708.bf2ac18)
Please Confirm