I am new to Ruby , ROR and NetBeans.
I am using Netbeans 6.5, Ruby 1.8 versions.
I created New Project in NetBeans by giving Project Name as DBTest,
selected Ruby Platform as Ruby 1.8.6-p111, server as Mongrel 1.1.5 and
in DataBase Configuration by selecting Specify Database Information
Directly (Database Adapter as mysql, DataBase Name as
DBTest_development, User Name as root ) .
And i Have 2 Model Classes : Book and Subject
My Book.rb class :
class Book < ActiveRecord::Base
belongs_to :subject
validates_presence_of :title
validates_numericality_of :price, :message=>"Error Message"
end
And my subject.rb class
class Subject < ActiveRecord::Base
end
And i created Migration classes for Book and Subject
20090423224145_books.rb file:
class Books < ActiveRecord::Migration
def self.up
create_table :books do |t|
t.string :title, :limit => 32, :null => false
t.float :price
t.integer :subject_id
t.text :description
t.timestamp :created_at
end
end
def self.down
end
end
20090423224238_subjects.rb file:
class Subjects < ActiveRecord::Migration
def self.up
create_table :subjects do |t|
t.string :name
end
Subject.create :name => "Physics"
Subject.create :name => "Mathematics"
Subject.create :name => "Chemistry"
Subject.create :name => "Psychology"
Subject.create :name => "Geography"
end
def self.down
end
end
And Now i am trying to create ths Tables from NetBeans by right clicking
on the project, selecting Run/Debug Rake Task(DB Test). And in that
Dialog box i selected db:create..........
Now i am getting the error massege saying
Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8",
"username"=>"root", "adapter"=>"mysql", "host"=>"localhost",
"password"=>"root", "database"=>"DBTest_development", "pool"=>5},
charset: utf8, collation: utf8_general_ci (if you set the charset
manually, make sure you have a matching collation)
Can any one help me to solve this problem. Please let me know how to
solve ths. Your response is highly appreciated
--
Posted via http://www.ruby-forum.com/.
> And Now i am trying to create ths Tables from NetBeans by right clicking
> on the project, selecting Run/Debug Rake Task(DB Test). And in that
> Dialog box i selected db:create..........
>
> Now i am getting the error massege saying
>
> Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8",
> "username"=>"root", "adapter"=>"mysql", "host"=>"localhost",
> "password"=>"root", "database"=>"DBTest_development", "pool"=>5},
> charset: utf8, collation: utf8_general_ci (if you set the charset
> manually, make sure you have a matching collation)
1) confirm that you can connect to MySQL manually using that
username and password
2) check your mysql logs (if you're not logging, configure that)
3) run the rake task from the command line
That should get you started :-)
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
Hi Hassan thanks for your response.
Actually every thing is working fine from command line. I can even start
my MYSQL server and run rake tasks.
And even its working fine if i am using Built-in JRuby1.1.4(Ruby
Platform)and server as GlassFish V3 or WEBrick from NETBeans.
But i am faceing this problem when i am using Ruby 1.8.6-p111(Ruby
Platform) and server as WEBrick or Mongrel 1.1.5.
Any Idea why it is hapenning only for Ruby 1.8.6-p111 server? Do i need
to do any setting in Netbeans? I can see correct details even in
database.yml file.
Please let me know if you have any idea. Your response is highly
> Any Idea why it is hapenning only for Ruby 1.8.6-p111 server? Do i
> need
> to do any setting in Netbeans? I can see correct details even in
> database.yml file.
>
> Please let me know if you have any idea. Your response is highly
> appreciated
Try to install the rubygems native mysql gem:
sudo gem install mysql
> Actually every thing is working fine from command line. I can even start
> my MYSQL server and run rake tasks.
rake tasks that access the DB?
> And even its working fine if i am using Built-in JRuby1.1.4
Uh, what? So you were able to create the database using JRuby?
Then running `rake db:create` again is bound to fail, right?
Maybe you can restate the exact nature of the problem. And if it's
still database-related, include the relevant entry from the MySQL log.
Hi Thanks for your response.
I tried giving gem install mysql. mysql got installed but with one
error. Please see the trace below.
C:\Group>gem install mysql
Successfully installed mysql-2.7.3-x86-mswin32
1 gem installed
Installing ri documentation for mysql-2.7.3-x86-mswin32...
Installing RDoc documentation for mysql-2.7.3-x86-mswin32...
ERROR: While generating documentation for mysql-2.7.3-x86-mswin32
... MESSAGE: Unhandled special: Special: type=17, text="<!-- $Id:
README.html,
v 1.20 2006-12-20 05:31:52 tommy Exp $ -->"
... RDOC args: --op
c:/ruby/lib/ruby/gems/1.8/doc/mysql-2.7.3-x86-mswin32/rdoc -
-exclude ext --main README --quiet ext README docs/README.html --title
mysql-2.7
.3-x86-mswin32 Documentation
(continuing with the rest of the installation)
then i gave rake db:migrate command
C:\Group>rake db:migrate --trace
(in C:/Group)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Client does not support authentication protocol requested by server;
consider u
grading MySQL client
c:/ruby/lib/ruby/1.8/mysql.rb:453:in `read'
c:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/mysql_adapter.rb:576:in `connect'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/mysql_adapter.rb:204:in `initialize'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/mysql_adapter.rb:76:in `new'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/mysql_adapter.rb:76:in `mysql_connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:223:in `send'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:223:in `new_connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:188:in `checkout'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:184:in `loop'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:184:in `checkout'
c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:183:in `checkout'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:98:in `connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_pool.rb:326:in `retrieve_connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_specification.rb:123:in
`retrieve_connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_
dapters/abstract/connection_specification.rb:115:in `connection'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.r
:435:in `initialize'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.r
:400:in `new'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.r
:400:in `up'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.r
:383:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/databases.rake:116
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
`invoke_with_call_
hain'
c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_
hain'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in
`invoke_task'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_excepti
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_excepti
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
c:/ruby/bin/rake:19:in `load'
c:/ruby/bin/rake:19
but i am faceing the error "Client does not support authentication
protocol requested by server; consider u grading MySQL client"
can any one please help me in solving this error? Thanks in advance.
> but i am faceing the error "Client does not support authentication
> protocol requested by server; consider u grading MySQL client"
It sounds like your mysql gem built against very old client libraries
(3.x,4.0.x) but you're trying to access a newer server.
I have no idea how to fix that on a Windows box, though. Sorry.