NetBeans 6.0 Rails Support

The new Ruby support flash demos on netbeans.org site are very good. I
am trying to duplicate them on my Windows XP machine. Running into

#28000Access denied for user ‘root’@‘localhost’ (using password: YES)

error when trying to run the blog_controller against MySQL database. I
have been able to connect to the database from within NetBeans create
table posts, execute queries etc. I have also set the database
connection information in the database.yml as follows:

development:
adapter: mysql
database: blogdemo_development
username: root
password: bharat
host: localhost

However, when I run the scaffolding command against the database, I get
the aforementioned error. Here is the full-stacktrace:

C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/vendor/mysql.rb:508:in
read' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/vendor/mysql.rb:150:in real_connect’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:330:in
connect' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:87:in initialize’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:36:in
new' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:36:in mysql_connection’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in
send' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in connection=’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_cache.rb:54:in
connection=' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in retrieve_connection’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
connection' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:696:in columns’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:216:in
column_for' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:138:in calculate’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:66:in
count' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:175:in count_collection_for_pagination’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:196:in
paginator_and_collection_for' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:129:in paginate’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:7:in
list' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:2:in index’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
send' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in perform_action’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
perform_action' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:68:in perform_action’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
measure' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in perform_action’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
perform_action_with_rescue' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in send’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
process' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in process’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
process_with_session_management_support' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in dispatch’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:120:in
handle_dispatch' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:83:in service’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/1.8/webrick/httpserver.rb:104:in
service' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/1.8/webrick/httpserver.rb:65:in run’
C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/1.8/webrick/server.rb:173:in
start_thread' C:/netbeans/nb6.0/jruby-0.9.2/lib/ruby/1.8/webrick/server.rb:95:in start’
Request
Parameters: None

Show session dump


flash: !map:ActionController::Flash::FlashHash {}

Response
Headers: {“Cache-Control”=>“no-cache”, “cookie”=>[]}

Was wondering if anyone else has run into this problem? and how to fix
it?

I have encountered that error with MySQL in the past due to the database
login permission.

Try (from command line): mysql -h localhost -u root -p bharat

If that can connect, then, MySQL engine is working okay with your
login/password.

If not, then the password could be incorrect or it allows access from
other
machines except for localhost. I fixed my error by changing my password
(bcoz I forgot what it was!).

E

Hello Elina,
I reinstalled MySQL, this time, without a password, and disallowed
remote access and everything works fine. I am not sure how to deal with
the password issue though. Admittedly, not a very secure system at this
point.
Regards,
Bharat

Elina Law wrote:

I have encountered that error with MySQL in the past due to the database
login permission.

Try (from command line): mysql -h localhost -u root -p bharat

If that can connect, then, MySQL engine is working okay with your
login/password.

If not, then the password could be incorrect or it allows access from
other
machines except for localhost. I fixed my error by changing my password
(bcoz I forgot what it was!).

E

Hello Elina,
Thanks for the quick response. I don’t have much experience with MySQL
and therefore must have installed it incorrectly. I went for complete
installation and installed it as Service. I also said allow remote
connections when Installing.

Oh. by the way the command did not work,here is the output:

C:\mysql50\bin>mysql -h localhost -u root -p bharat
Enter password: ******
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

Something that puzzles me is how is it that I can connect the MySQL
Command Line client utility that I run from the start menu using the
same password as ‘bharat’. That puts me in the MySQL environement and I
can see all the databases, create them etc. Do I have to reset the
password? Also, the NetBeans client can connect to this database
without any problems? Perhaps there is something here that I am
missing??
Bharat

Hi Bharat,

If you are using the password “bharat”, then is the host or the user
different? I am not familiar with the command line utility that you are
using.

E

Thank you Elina. I will definitely follow through. In the meantime,
Ruby on NetBeans looks really good, check it out.

Hi Bharat,

Didn’t realise you have responded with a “reinstall”. Got pulled away
from
my desk.

It would have been the MySQL setup. Try adding a piece of the security
at a
time, eg set password, test RoR. Then allow remote access and test RoR.

There are some HowTos on the MySQL site. If your RoR setup is on the
same
machine as the database (and you don’t need remote access to administer
your
database), you can do without remote access.

Try this HowTo for setting up a non-root user for your RoR application.
http://dev.mysql.com/doc/refman/5.0/en/create-user.html

You can use http://dev.mysql.com/doc/refman/5.0/en/set-password.html to
help
secure your root access.

Same login test applies with different user names and password.

E