NetBeans 6.0 Rails Support


#1

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:inreal_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:ininitialize’
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:inmysql_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:inconnection=’
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:inretrieve_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:incolumns’
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:incalculate’
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:incount_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:inpaginate’
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:inindex’
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:inperform_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:inperform_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:inperform_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:insend’
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:inprocess’
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:indispatch’
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:inservice’
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:inrun’
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:instart’
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?


#2

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


#3

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


#4

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


#5

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


#6

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


#7

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