Connecting mySQL to Ruby on NETBEAN 8.0

vendredi 19 septembre 2014

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





0 commentaires:

Enregistrer un commentaire