The only instructions for getting ruby to access mysql that I've been able to find seem to be
oriented to non-windows os's. The instructions talk about mysql c api header files, but I can't find
them. Can someone tell me how to get ruby on windows xp to talk to mysql?
thanks,
Ralph
Ralph Smith wrote:
The only instructions for getting ruby to access mysql that I've been able to find seem to be
oriented to non-windows os's. The instructions talk about mysql c api header files, but I can't find
them. Can someone tell me how to get ruby on windows xp to talk to mysql?
Simplest way is to get the pure-Ruby MySQL binding.
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/136505
Sort of old, but generally correct.
James Britt
···
--
http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
Hi,
Ruby/MySQL is from the same author of mysql-ruby. The difference is that ruby-mysql is in PURE ruby. I have no problem at all using it on XP. Very convenient.
Take a look at its home page:
http://www.tmtm.org/en/ruby/mysql/README_en.html
Shannon
···
From: Ralph Smith <ralph@lkjlkj.com>
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: mysql & ruby on windows?
Date: Wed, 19 Oct 2005 09:46:58 +0900
The only instructions for getting ruby to access mysql that I've been able to find seem to be
oriented to non-windows os's. The instructions talk about mysql c api header files, but I can't find
them. Can someone tell me how to get ruby on windows xp to talk to mysql?
thanks,
Ralph
I followed these instruction.
1) Download ruby-mysql-0.2.5.tar.gz from http://www.tmtm.org/en/ruby/mysql/README_en.html\.
This link is bad, but I found ruby-mysql-0.2.6.tar.gz at
http://raa.ruby-lang.org/project/ruby-mysql/0.2.6
2) Unzip this file.
I did this. This is what is confusing. The README_en.html in this says to:
% ruby ./setup.rb
% ruby ./test.rb hostname user passwd
# ruby ./install.rb
If I run 'ruby ./setup.rb' I get an error message:
../setup.rb:8:in ``': No such file or directory - mysql_config --socket (Errno::E
NOENT)
from ./setup.rb:8
So, I abandoned following these instructions, since the instructions don't mention needing to do
this anyway.
3) Copy mysql.rb to $RUBY_HOME\lib\ruby\1.8.
I did this.
I then tried the sample code on the instruction page, with a valid username, password, database and
table, but it doesn't connect and goes to the rescue code. So, I still would like to get mysql
working with ruby on windows xp. What am I doing wrong?
Sample code:
require 'mysql'
host = 'localhost'
username = 'root'
password = ''
database = 'music'
begin
conn = Mysql.new(host, username, password, database)
puts "connected" <<<<<<<<<<<<<<<<<<< DOESN'T GET HERE
rs = conn.query('select * from artists')
column_name = 'name'
rs.each_hash do |row|
puts "name = #{row[column_name]}"
end
rescue Mysql::Error => e
#puts "Error! #{e.err}"
puts "error here" <<<<<<<<<<<<<<<<<<<< GETS HERE
ensure
conn.close if conn
end
thanks,
Ralph
···
On Wed, 19 Oct 2005 09:51:46 +0900, James Britt <james_b@neurogami.com> wrote:
Ralph Smith wrote:
The only instructions for getting ruby to access mysql that I've been able to find seem to be
oriented to non-windows os's. The instructions talk about mysql c api header files, but I can't find
them. Can someone tell me how to get ruby on windows xp to talk to mysql?
Simplest way is to get the pure-Ruby MySQL binding.
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/136505
Sort of old, but generally correct.
James Britt