Hello all, I''m in my 5th month on Ruby on Rails and still learning. I have an application that works fine in sqlite3 and then the boss says he wants it migrated to Oracle. Now, I know very little about Oracle, enough to get into trouble. When I did the migration everything went haywire. Well, I''ve refactored several problems and now I have another. I have two models with a many to many relationship and additional join model. This model has no PK id. When I try to do a create() to this model, BLAM! I get this... Processing ReviewsController#create_association (for 10.242.2.10 at 2010-02-24 15:29:08) [GET] Parameters: {"review"=>{"irb_id"=>["35540"]}, "action"=>"create_association", "id"=>"1", "controller"=>"reviews"} ActiveRecord::StatementInvalid (OCIError: ORA-02289: sequence does not exist: SELECT reviews_seq.NEXTVAL id FROM dual): C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1359:in `log'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1283:in `select'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:606:in `next_sequence_value'' app/controllers/reviews_controller.rb:27:in `create_association'' Rendering C:/RoRApps/ProjectDB/public/500.html (500 Internal Server Error) I believe it''s because of the lack of an ID for the joined model. Thank you for any advice here. JohnM -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
In Oracle you need to create ''sequences'' which populate primary keys. Given the choice, I would steer clear of Oracle with Rails - what''s you boss'' reasoning for wanting to use it over sqlite or mysql? On Feb 24, 2010 8:44 PM, "John Mcleod" <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: Hello all, I''m in my 5th month on Ruby on Rails and still learning. I have an application that works fine in sqlite3 and then the boss says he wants it migrated to Oracle. Now, I know very little about Oracle, enough to get into trouble. When I did the migration everything went haywire. Well, I''ve refactored several problems and now I have another. I have two models with a many to many relationship and additional join model. This model has no PK id. When I try to do a create() to this model, BLAM! I get this... Processing ReviewsController#create_association (for 10.242.2.10 at 2010-02-24 15:29:08) [GET] Parameters: {"review"=>{"irb_id"=>["35540"]}, "action"=>"create_association", "id"=>"1", "controller"=>"reviews"} ActiveRecord::StatementInvalid (OCIError: ORA-02289: sequence does not exist: SELECT reviews_seq.NEXTVAL id FROM dual): C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1359:in `log'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1283:in `select'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:606:in `next_sequence_value'' app/controllers/reviews_controller.rb:27:in `create_association'' Rendering C:/RoRApps/ProjectDB/public/500.html (500 Internal Server Error) I believe it''s because of the lack of an ID for the joined model. Thank you for any advice here. JohnM -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Well, I just added an PK ID into the joined table and good to go. Thanks John -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I agree with you. I had the application working fine with SQLite and then he (not just he but the department) wanted the Oracle migration. The reason being is the department is a big Oracle house, even though they have apps with MS-SQL and mySQL. Oh, I did create a sequence also. All works for now. I''ve had one heck of a time in the migration over to Oracle. Thanks again. John -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 25 February 2010 14:09, John Mcleod <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> The reason being is the department is a big Oracle house, even though > they have apps with MS-SQL and mySQL. > > I''ve had one heck of a time in the migration over to Oracle.The last time (spring 2009) I had to use Oracle with Rails, I was finding occasional bugs in the adapter code (which was frustrating). And Oracle''s handling of midnight/midday was a bit of a thorny issue too. No idea if it''s been advanced, but forewarned is forearmed :-) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Possibly Parallel Threads
- Problem with Redmine
- rails application working, rake tasks not
- ActiveRecord::StatementInvalid (invalid date) with Oracle
- ORA-12514: TNS:listener d oes not currently know of service requested in connect descriptor (OCIEr
- problem using build with has_many :through relationship