Ruby Forum Rails-ES > restful_authentication and oracle

Posted by Aprendiz_ror Ruby on rails (aprendiz_ror)
on 15.08.2008 22:18
buenas tardes.

amigos de la lista, gracias por apoyarnos.

tengo un error con este plugin y oracle, al momento de crear un usuario.

el error es el siguiente:


OCIError in UsuariosController#create

ORA-02289: sequence does not exist

RAILS_ROOT: C:/rails/sma
Application Trace | Framework Trace | Full Trace

stmt.c:539:in oci8lib.so
app/controllers/usuarios_controller.rb:17:in `create'

c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:753:in `exec'
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:142:in `do_ocicall'
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:753:in `exec'
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:255:in `exec'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:730:in
`exec'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:258:in
`next_sequence_value'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2493:in
`create_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:220:in
`create_without_timestamps'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/timestamp.rb:29:in
`create'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2472:in
`create_or_update_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:207:in
`create_or_update'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2200:in
`save_without_validation'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations.rb:901:in
`save_without_dirty'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/dirty.rb:75:in
`save_without_transactions'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:79:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:98:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:118:in
`rollback_active_record_state!'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
`perform_action_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in
`call_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in
`perform_action_without_benchmark'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in
`perform_action_without_caching'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in
`perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in
`cache'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in
`perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
`process_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in
`process_without_session_management_support'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in
`handle_request'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
`synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in
`dispatch_cgi'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/rails.rb:76:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/rails.rb:74:in
`synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/rails.rb:74:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:159:in
`process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:158:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:158:in
`process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
`initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
`new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/configurator.rb:282:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/configurator.rb:281:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/configurator.rb:281:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel_rails:128:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/command.rb:212:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel_rails:281
c:/ruby/bin/mongrel_rails:16:in `load'
c:/ruby/bin/mongrel_rails:16

stmt.c:539:in oci8lib.so
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:753:in `exec'
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:142:in `do_ocicall'
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:753:in `exec'
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:255:in `exec'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:730:in
`exec'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:258:in
`next_sequence_value'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2493:in
`create_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:220:in
`create_without_timestamps'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/timestamp.rb:29:in
`create'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2472:in
`create_or_update_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:207:in
`create_or_update'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2200:in
`save_without_validation'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations.rb:901:in
`save_without_dirty'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/dirty.rb:75:in
`save_without_transactions'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:79:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:98:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:118:in
`rollback_active_record_state!'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions.rb:106:in
`save'
app/controllers/usuarios_controller.rb:17:in `create'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
`perform_action_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in
`call_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in
`perform_action_without_benchmark'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in
`perform_action_without_caching'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in
`perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in
`cache'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in
`perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
`process_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in
`process_without_session_management_support'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in
`handle_request'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
`synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in
`dispatch_cgi'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/rails.rb:76:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/rails.rb:74:in
`synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/rails.rb:74:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:159:in
`process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:158:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:158:in
`process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
`initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
`new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/configurator.rb:282:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/configurator.rb:281:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/configurator.rb:281:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel_rails:128:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel/command.rb:212:in
`run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/bin/mongrel_rails:281
c:/ruby/bin/mongrel_rails:16:in `load'
c:/ruby/bin/mongrel_rails:16

Request

Parameters:

{"commit"=>"Sign up",
 "authenticity_token"=>"e7779290d663bc9e00e948e08bb30b9850298003",
 "usuario"=>{"password_confirmation"=>"sma2008",
 "login"=>"smaa",
 "password"=>"sma2008",
 "email"=>"smaa"}}

Show session dump

---
:return_to: /historias
:usuario_id:
flash: !map:ActionController::Flash::FlashHash {}


Response

Headers:

{"cookie"=>[[]],
 "Cache-Control"=>"no-cache"}
Posted by Xavier Noria (fxn)
on 15.08.2008 22:24
(Received via mailing list)
On Fri, Aug 15, 2008 at 10:18 PM, Aprendiz_ror Ruby on rails
<ruby-forum-incoming@andreas-s.net> wrote:

>
> ORA-02289: sequence does not exist

Es posible que el plugin mismo no tenga nada que ver. Puedes lanzar la
consola y tratar de crear un usuario ahi?
Posted by Benjamín Cárdenas Salamandra (Guest)
on 16.08.2008 01:16
(Received via mailing list)
Parece que el migrate o el método que usaste para crear las tablas, no
creó la secuencia de la tabla usuarios,

Benjamín
Aprendiz_ror Ruby on rails 
escribió:> buenas tardes.
Posted by William Fernando (numerouno)
on 16.08.2008 02:07
hola Benjamín Cárdenas Salamandra wrote:

si cree la sequence en una trigger pre-insert, al lado de la base de 
datos, esto para emular un campo auto-increment de mysql, y me funciona 
desde sqlplus.

saludos
Posted by William Fernando (numerouno)
on 16.08.2008 02:10
gracias Xavier, lo hare despues, pues sali de la oficina.

luego te cuento.
Posted by Xavier Noria (fxn)
on 16.08.2008 11:40
(Received via mailing list)
2008/8/16 William Fernando <ruby-forum-incoming@andreas-s.net>:

> si cree la sequence en una trigger pre-insert, al lado de la base de
> datos, esto para emular un campo auto-increment de mysql, y me funciona
> desde sqlplus.

AR no necesita un campo autoincremental en las tablas (Oracle no
tiene). La secuencia asociada al ID la crea y la maneja el adaptador
de Oracle automaticamente. Desde el punto de vista de uso, migrations,
Model.create, etc. todo queda igual para el programador.

Si la secuencia no existe posiblemente hayas hecho algo a mano.
Posted by Aprendiz_ror Ruby on rails (aprendiz_ror)
on 20.08.2008 18:16
Xavier Noria wrote:
> 2008/8/16 William Fernando <ruby-forum-incoming@andreas-s.net>:
> 
>> si cree la sequence en una trigger pre-insert, al lado de la base de
>> datos, esto para emular un campo auto-increment de mysql, y me funciona
>> desde sqlplus.
> 
> AR no necesita un campo autoincremental en las tablas (Oracle no
> tiene). La secuencia asociada al ID la crea y la maneja el adaptador
> de Oracle automaticamente. Desde el punto de vista de uso, migrations,
> Model.create, etc. todo queda igual para el programador.
> 
> Si la secuencia no existe posiblemente hayas hecho algo a mano.

Hola Xavier, si hice a mano la tabla de oracle y la secuencia en un 
trigger pre-insert.

saludos
Posted by Aprendiz_ror Ruby on rails (aprendiz_ror)
on 20.08.2008 20:50
Hola Xavier, tenias razon como siempre.

borre la tabla de la database,
ejecute rake db:migrate

y listo solucionado, ya funciona el plugins restful_authentication en 
oracle

saludos y mil gracias