You can download package from here
Execute: ruby extconf.rb --with-mysql-config
Then make;make install
Step 2: Write simple ruby client.
require "mysql"
my = Mysql.connect("localhost", "", "", "test")
puts my
res = my.query("select * from tblMovies")
res.each do |row|
puts row[0]+row[1]
end
That's it! Now you can access a database with Ruby.
No comments:
Post a Comment