Connecting mySQL to Ruby on NETBEAN 8.0

  • Thread starter Thread starter infinite.curve
  • Start date Start date
  • Tags Tags
    Mysql Ruby
Click For Summary

Discussion Overview

The discussion revolves around the issue of connecting MySQL to Ruby within the NetBeans IDE. Participants are exploring the error messages encountered during the connection attempt and discussing potential causes and solutions.

Discussion Character

  • Technical explanation, Debate/contested, Problem-solving

Main Points Raised

  • One participant shares their Ruby code for connecting to MySQL and describes the LoadError encountered, indicating that the 'mysql' library cannot be loaded.
  • Another participant, who identifies as not being a Ruby developer, provides a link to a Ruby MySQL tutorial, suggesting it may offer assistance.
  • A participant notes that the LoadError occurs before any database connection attempt is made, implying an issue with the environment setup.
  • Another participant suggests that the problem may be related to the MySQL server itself, indicating it might not be able to access the necessary database files.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the exact cause of the issue, with multiple perspectives on whether it is a library loading problem or a server access issue.

Contextual Notes

There are indications of missing dependencies or misconfigurations in the Ruby environment that may not have been fully explored or resolved.

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
 
Technology 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.