Ruby on Rails Wednesday, April 28, 2010

For anyone interested in this topic, see this thread:

http://groups.google.com/group/ruby-on-rails-sybase-developers/browse_thread/thread/1eca62c3578cdf34?hl=en

Best regards,
Rolf


On Wed, Apr 28, 2010 at 2:07 PM, Rolf Pedersen <rolfhsp@gmail.com> wrote:
Hi

I'm trying to use the activerecord-sybase-adapter to be able to use ASE with my rails applications.
But, I am struggling...

I followed (most of) the steps on this informative page:
http://trevoke.net/blog/2009/09/11/connecting-to-sybase-with-rails-on-windows-xp/

Initially I had Rails 2.3.5 installed.
I copied the "Ruby Sybase files" as instructed and the Sybase dll files as well, and I installed activerecord-sybase-adapter (1.0.0.9250).
The Sybase environment I already have on my office computer, so it should be allright.
I don't have the mentioned JDBC_HOME setting or the classpath setting, but I'm using Open Client, so should there be any need for the JDBC settings?

Ok, things looked promising, and I started creating a test rails app.

rails testapp

I then edited the database.yml to fit Sybase ASE
development:
  adapter: sybase
  database: testdb
  username: username
  password: password
  host: sauron

The host, sauron, is defined in the sql.ini file.

Running rake db:create tells me that the database testdb already exists. (true)
ruby script\generate scaffold person first_name:string last_name:string     WORKS OK
rake db:migrate --trace    FAILS!
(in C:/work/ror/testapp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
undefined method `select_rows' for #<ActiveRecord::ConnectionAdapters::SybaseAdapter:0x97d8be8>
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:27:in `select_values'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:416:in `get_all_versions'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:532:in `migrated'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:441:in `current_version'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:458:in `migrate'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:115:in `detect'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:458:in `each'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:458:in `detect'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:458:in `migrate'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `up'
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:in `migrate'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
c:/prg/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
c:/prg/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
c:/prg/ruby/bin/rake:19:in `load'
c:/prg/ruby/bin/rake:19



so... looks like something's missing here. In mysql_adapter.rb there is a select_row function, but not in the sybase_adapter.rb.

I tried downgrading Rails to 2.1.0 because I read somewhere that the activerecord-sybase-adapter perhaps was not working for the latest Rails releases, but got only a slightly different error message:
rake aborted!
select_rows is an abstract method
c:/prg/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:34:in `select_rows'
...

Anyone has an idea?

Best regards,
Rolf

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment