I''m a very beginner to rails and try to set up a tiny app in rails and MySQL. It all happens on Mac OS X, Ruby 1.8.2 and MySQL 4.1.x installed locally. I''ve set up everything configured database.yml and wrote my first lines (it would be a user login page). After entering user name and password in the web interface I get the following error: ActiverRecord::InvalidStatement Database Not Selected: SELECT * FROM USER WHERE .... The SQL syntax seemed correct but I don''t understand "Database Not Selected". I''ve only slightly modified database.yml by replacing database name and mysql login/pwd fields. What am I missing? I''ve not installed native ruby msql adaptor yet assuming ActiveRecord has its own. Please help me I''m stuck with this issue. Thanks. Gábor deliahe - "a szemetet egy helyre sodorja a sale"
I retried and run to wall again. The error precisely is: ActiveRecord::StatementInvalid in Operator#login No database selected: SELECT * FROM operator WHERE login = ''asd'' AND password = ''asd'' LIMIT 1 I''m sure Rails is aware of running mysql (when I forgot to start the server Rails complained of lacking mysql lock). Experts show me the light! :)
please post the contents of your database.yml On 4/19/05, Gábor Sebestyén <segabor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I retried and run to wall again. The error precisely is: > > ActiveRecord::StatementInvalid in Operator#login > > No database selected: SELECT * FROM operator WHERE login = ''asd'' AND > password = ''asd'' LIMIT 1 > > I''m sure Rails is aware of running mysql (when I forgot to start the > server Rails complained of lacking mysql lock). > > Experts show me the light! :) > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
You do have the databases created, don''t you? //jarkko On 19.4.2005, at 10:30, Gábor Sebestyén wrote:> I retried and run to wall again. The error precisely is: > > ActiveRecord::StatementInvalid in Operator#login > > No database selected: SELECT * FROM operator WHERE login = ''asd'' AND > password = ''asd'' LIMIT 1 > > I''m sure Rails is aware of running mysql (when I forgot to start the > server Rails complained of lacking mysql lock). > > Experts show me the light! :) > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 4/19/05, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> wrote:> You do have the databases created, don''t you? >Yep. I doublechecked with mysql.
On 4/19/05, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> please post the contents of your database.ymldevelopment: adapter: mysql database: hdchat host: localhost username: webuser password: ... That''s all. Anyway here''s the full crash backtrace: /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/connection_adapters/abstract_adapter.rb:422:in `log'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/connection_adapters/mysql_adapter.rb:116:in `execute'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/connection_adapters/mysql_adapter.rb:202:in `select'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/connection_adapters/mysql_adapter.rb:94:in `select_all'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/base.rb:366:in `find_by_sql'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/base.rb:334:in `find'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/base.rb:332:in `find'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.0/lib/active_record/deprecated_finders.rb:22:in `find_first'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/base.rb:708:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/base.rb:708:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/filters.rb:294:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/benchmarking.rb:34:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/benchmarking.rb:34:in `measure'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/benchmarking.rb:34:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/rescue.rb:79:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/base.rb:330:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/base.rb:330:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.0/lib/action_controller/base.rb:273:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-0.12.0/lib/dispatcher.rb:32:in `dispatch'' /Workspace/_works_/hdchat/webapp/trunk/hdchat/public/dispatch.rb:10 /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:189:in `load'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:189:in `load'' /usr/lib/ruby/gems/1.8/gems/rails-0.12.0/lib/webrick_server.rb:82:in `handle_dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-0.12.0/lib/webrick_server.rb:35:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:144:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:94:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:89:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:89:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:79:in `start'' /usr/lib/ruby/gems/1.8/gems/rails-0.12.0/lib/webrick_server.rb:21:in `dispatch''
Gábor Sebestyén <segabor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:>> please post the contents of your database.yml > development: > adapter: mysql > database: hdchat > host: localhost > username: webuser > password:I''m not sure it''s OK to have an empty password. Try setting it to something and see if that helps. -- doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org
Do you have mysql-ruby ? Try: gem install mysql 2005/4/19, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org>:> > Gábor Sebestyén <segabor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > >> please post the contents of your database.yml > > development: > > adapter: mysql > > database: hdchat > > host: localhost > > username: webuser > > password: > > I''m not sure it''s OK to have an empty password. Try setting it to > something and see if that helps. > -- > doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Giovanni Degani tiefox-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org ICQ 965609 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I''m not sure it''s ok to share your password with the Rails list :) And yes, an empty password works fine.> I''m not sure it''s OK to have an empty password. Try setting it to > something and see if that helps.-- rick http://techno-weenie.net