Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Connecting mySQL to Ruby on NETBEAN 8.0

  1. Sep 19, 2014 #1
    So... I hae this issue trying to connect mySQL to ruby on net bean... Has anyone connected it before?

    The code:


    require 'mysql'

    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

    con.close if con

    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
  2. jcsd
  3. Sep 22, 2014 #2


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

  4. Sep 22, 2014 #3


    User Avatar

    Staff: Mentor

    Looks like the problem occurs long before you try to connect to the database.
  5. Oct 17, 2014 #4
    Looks like it's a MySQL server issue as it's not able to access the database file that you're trying to pull.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Connecting mySQL Ruby
MySQL: Best way to warehouse older data