Connecting mySQL to Ruby on NETBEAN 8.0

  • Thread starter Thread starter infinite.curve
  • Start date Start date
  • Tags Tags
    Mysql Ruby
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
infinite.curve
Messages
23
Reaction score
1
So... I hae this issue trying to connect mySQL to ruby on net bean... Has anyone connected it before?

The code:

#!/user/bin/ruby


require 'mysql'


begin
puts "hello World"
con = Mysql.new 'localhost', 'sqluser', ''
puts con.get_server_info
rs = con.query 'SELECT VERSION();'
puts rs.fetch_row

rescue Mysql::Error => e
puts e.errno
puts e.error

ensure
con.close if con
end

LoadError: no such file to load -- mysql
require at org/jruby/RubyKernel.java:1027
require at /Users/eugenelemon/Library/Application Support/NetBeans/8.0/jruby/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at /Users/eugenelemon/NetBeansProjects/RubyApplication1/lib/main.rb:9
 
Physics news on Phys.org
I'm not a Ruby developer but perhaps this will help.

http://rubylearning.com/satishtalim/ruby_mysql_tutorial.html
 
infinite.curve said:
LoadError: no such file to load -- mysql

Looks like the problem occurs long before you try to connect to the database.
 
Looks like it's a MySQL server issue as it's not able to access the database file that you're trying to pull.