Hi,

I hope this is the right place to ask, and if not, that someone can
point me to the right place.

We have a working Rails app which I want to test with JRuby, but after
following the JRuby Wiki I am stumped by the behaviour of the
activerecord-jdbc-adapter. In a nutshell, if I run the rails console,
[NB, windows] ie:

jruby scripts\console

Then try to load a model and fetch some records:

>> c = Customers.find(:all)

I get the following exception backtrace:

ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError: Table
[Customers] does not exist: SELECT * FROM [Customers]
        from
T:/ABM/BMSWeb/vendor/rails/activerecord/lib/active_record/connection_ada
pters/abstract_adapter.rb:151:in `log'
        from
C:/BMS_Web_For_ABM/jruby/1.1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-
adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:520:in
`execute'
        from
C:/BMS_Web_For_ABM/jruby/1.1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-
adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:580:in
`select'
        from
C:/BMS_Web_For_ABM/jruby/1.1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-
adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:505:in
`jdbc_select_all'
        from
T:/ABM/BMSWeb/vendor/rails/activerecord/lib/active_record/connection_ada
pters/abstract/query_cache.rb:55:in `select_all_with_query_cache'
        from
T:/ABM/BMSWeb/vendor/rails/activerecord/lib/active_record/base.rb:559:in
`find_by_sql'
        from
T:/ABM/BMSWeb/vendor/rails/activerecord/lib/active_record/base.rb:1314:i
n `find_every'
        from
T:/ABM/BMSWeb/vendor/rails/activerecord/lib/active_record/base.rb:518:in
`find'
        from (irb):2:in `signal_status'


Of course, Customers DOES exists. The problem seems to be that the
tablename is delimited by square brackets.

If I then manually construct the SQL, then the select works, ie:

>> c = Customers.find_by_sql('select * from Customers')
=> LOTS OF DATA

Configuration:
 JRuby 1.1.1
 Rails 2.1 RC Revision 9250 [in vendor via rake:freeze:edge]
 Microsoft SQL Server 2005 "sqljdbc" 1.2
 Activerecord-jdbc-adapter 0.8

My database.yml configuration looks like this:

  adapter:  jdbc
  url:
jdbc:sqlserver://myserver;databasename=mydb;integratedSecurity=true;
  driver:   com.microsoft.sqlserver.jdbc.SQLServerDriver


Looking forward to any help,

Regards

Neville
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to