Forum: Ruby on Rails Oracle-JRuby error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Norman S. (Guest)
on 2009-05-06 02:05
I am trying to migrate from RoR/MYSql to JRoR/Oracle. I am using Active
Record JDBC to talk to the database. The Migration process to create and
populate the database tables has been painful. My latest issue is the
method new_date is undefined in the JDBC adapter. I have the following
gems installed:

*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
ActiveRecord-JDBC (0.5)
activerecord-jdbc-adapter (0.9.1)
activeresource (2.2.2)
activesupport (2.2.2)
net-sftp (2.0.2)
net-ssh (2.0.11)
parseexcel (0.5.2)
rails (2.2.2)
rake (0.8.4)
rspec (1.2.0)
rubyzip (0.9.1)
rufus-scheduler (1.0.13)
sources (0.0.1)

The error dump is:

undefined method `new_date' for JdbcSpec::Oracle::Column:Module
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.1/lib/jdbc_adapter/jdbc_oracle.rb:63:in
`guess_date_or_time'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.1/lib/jdbc_adapter/jdbc_oracle.rb:59:in
`string_to_time'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.1/lib/jdbc_adapter/jdbc_oracle.rb:43:in
`type_cast'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/dirty.rb:161:in
`field_changed?'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/dirty.rb:135:in
`write_attribute_with_dirty'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:216:in
`stop_date='
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2587:in
`attributes='
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2583:in
`each'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2583:in
`attributes='
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2283:in
`initialize'
db/migrate//20080702000004_update_schedules.rb:5:in `up'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:280:in
`migrate'
C:/jruby-1.2.0/bin/../lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:280:in
`migrate'
(__DELEGATION__):2:in `migrate'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:480:in
`migrate'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:556:in
`call'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:556:in
`ddl_transaction'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:479:in
`migrate'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:466:in
`each'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:466:in
`migrate'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:394:in
`up'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:377:in
`migrate'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:111
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in
`call'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in
`execute'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in
`each'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in
`execute'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
`invoke_with_call_chain'
C:/jruby-1.2.0/bin/../lib/ruby/1.8/monitor.rb:191:in `mon_synchronize'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_chain'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in
`invoke'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in
`invoke_task'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`each'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_exception_handling'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
`top_level'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in
`run'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_exception_handling'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in
`run'
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
C:/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:19:in `load'
C:\jruby-1.2.0\bin\..\bin\rake:19

This is from a db:migrate run to insert data into a table that contains
three date fields. The code snippet is:

    p = Schedule.new(
                    :frequency               => "3",
                    :status                  => "Active",
                    :stop_date               => "01-01-2020",
                    :p_date                  => "01-01-2008",
                    :start_date              => "01-01-2008"
                   )

    p.save()

The migration scripts up to this point do insert data. Am I doing
something wrong or is this a bug that I need to report somewhere? Any
pointers are appreciated!!!

For the record, this app works with JRuby on Rails and MySQL or SQLite
and JDBC with just the usual database.yml changes and installing the
appropriate adapters.

Norm
Hassan S. (Guest)
on 2009-05-06 02:25
(Received via mailing list)
On Tue, May 5, 2009 at 3:05 PM, Norman Smith
<removed_email_address@domain.invalid> wrote:
>
> I am trying to migrate from RoR/MYSql to JRoR/Oracle. I am using Active
> Record JDBC to talk to the database. The Migration process to create and
> populate the database tables has been painful. My latest issue is the
> method new_date is undefined in the JDBC adapter. I have the following
> gems installed:

but which ones are you requiring in your app? If this is one,

> activerecord-jdbc-adapter (0.9.1)

you might want to try activerecord-jdbc-adaptor 0.8 for comparison;
I'm trying to sort out some inconsistencies in this area right now.

Also, what driver (jar) file are you using?

--
Hassan S. ------------------------ removed_email_address@domain.invalid
Norman S. (Guest)
on 2009-05-06 16:47
Hassan S. wrote:
> On Tue, May 5, 2009 at 3:05 PM, Norman Smith
> <removed_email_address@domain.invalid> wrote:
>>
>> I am trying to migrate from RoR/MYSql to JRoR/Oracle. I am using Active
>> Record JDBC to talk to the database. The Migration process to create and
>> populate the database tables has been painful. My latest issue is the
>> method new_date is undefined in the JDBC adapter. I have the following
>> gems installed:
>
> but which ones are you requiring in your app? If this is one,
>
>> activerecord-jdbc-adapter (0.9.1)

I am using ojdbc14.jar and, yes 0.9.1 for the jdbc adapter.

>
> you might want to try activerecord-jdbc-adaptor 0.8 for comparison;
> I'm trying to sort out some inconsistencies in this area right now.

I will try the 0.8 jdbc adapter!

Thanks for the suggestion! I will post my results.

Norm
Norman S. (Guest)
on 2009-05-06 18:08
Norman Smith wrote:
>>
>> you might want to try activerecord-jdbc-adaptor 0.8 for comparison;
>> I'm trying to sort out some inconsistencies in this area right now.
>
> I will try the 0.8 jdbc adapter!
>

The 0.8 adapter works! I still have a couple of issues that I will post
separately, but I'm over this huge hurdle for the moment!

Thanks again!!!!
Norm
This topic is locked and can not be replied to.