[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

require mysql do not work

Guillermo.Acilu

6/9/2008 6:38:00 PM

[Note: parts of this message were removed to make it a legal post.]

Hello guys,

I am new to Ruby. I have been working with the core language so far
without problems. Now I am starting to use mysql.

I have installed it with gem install mysql, and it work perfectly. If I
run gem list, I get the following:

sh-3.2# gem list

*** LOCAL GEMS ***

actionmailer (2.1.0, 1.3.6)
actionpack (2.1.0, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.1.0, 1.15.6)
activeresource (2.1.0)
activesupport (2.1.0, 1.4.4)
acts_as_ferret (0.4.3, 0.4.1)
capistrano (2.3.0, 2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.10, 1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.6, 0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.4.0, 1.2.9)
hpricot (0.6)
libxml-ruby (0.5.4, 0.3.8.4)
mongrel (1.1.5, 1.1.4, 1.0.1)
mysql (2.7)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.0)
net-ssh (2.0.2, 1.1.2)
net-ssh-gateway (1.0.0)
rails (2.1.0, 1.2.6)
rake (0.8.1, 0.7.3)
RedCloth (3.0.4)
ruby-openid (2.0.4, 1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.1.1)
rubynode (0.1.5, 0.1.3)
sqlite3-ruby (1.2.2, 1.2.1)
termios (0.9.4)

As you can see mysql 2.7 is installed. When I put the line require "mysql"
in the first line of my program, I get the following error:

sh-3.2# ruby learn.rb
learn.rb:1:in `require': no such file to load -- mysql (LoadError)
from learn.rb:1

I am on Mac OS X 10.5.3 with Ruby 1.8.6, and the outputs included in the
email have been generated with "root". Any ideas why it is not working?

Thanks,

Guillermo

2 Answers

Luis Lavena

6/9/2008 7:05:00 PM

0

On Jun 9, 8:38 pm, Guillermo.Ac...@koiaka.com wrote:
> [Note:  parts of this message were removed to make it a legal post.]
>
> Hello guys,
>
> I am new to Ruby. I have been working with the core language so far
> without problems. Now I am starting to use mysql.
>
> I have installed it with gem install mysql, and it work perfectly. If I
> run gem list, I get the following:
>
> sh-3.2# gem list
>
> *** LOCAL GEMS ***
>
> actionmailer (2.1.0, 1.3.6)
> actionpack (2.1.0, 1.13.6)
> actionwebservice (1.2.6)
> activerecord (2.1.0, 1.15.6)
> activeresource (2.1.0)
> activesupport (2.1.0, 1.4.4)
> acts_as_ferret (0.4.3, 0.4.1)
> capistrano (2.3.0, 2.0.0)
> cgi_multipart_eof_fix (2.5.0, 2.2)
> daemons (1.0.10, 1.0.9, 1.0.7)
> dnssd (0.6.0)
> fastthread (1.0.1, 1.0)
> fcgi (0.8.7)
> ferret (0.11.6, 0.11.4)
> gem_plugin (0.2.3, 0.2.2)
> highline (1.4.0, 1.2.9)
> hpricot (0.6)
> libxml-ruby (0.5.4, 0.3.8.4)
> mongrel (1.1.5, 1.1.4, 1.0.1)
> mysql (2.7)
> needle (1.3.0)
> net-scp (1.0.1)
> net-sftp (2.0.1, 1.1.0)
> net-ssh (2.0.2, 1.1.2)
> net-ssh-gateway (1.0.0)
> rails (2.1.0, 1.2.6)
> rake (0.8.1, 0.7.3)
> RedCloth (3.0.4)
> ruby-openid (2.0.4, 1.1.4)
> ruby-yadis (0.3.4)
> rubygems-update (1.1.1)
> rubynode (0.1.5, 0.1.3)
> sqlite3-ruby (1.2.2, 1.2.1)
> termios (0.9.4)
>
> As you can see mysql 2.7 is installed. When I put the line require "mysql"
> in the first line of my program, I get the following error:
>
> sh-3.2# ruby learn.rb
> learn.rb:1:in `require': no such file to load -- mysql (LoadError)
>         from learn.rb:1
>
> I am on Mac OS X 10.5.3 with Ruby 1.8.6, and the outputs included in the
> email have been generated with "root". Any ideas why it is not working?
>

try this:

require 'rubygems'
require 'mysql'

mysql being installed as gem require you first load rubygems to work
(unless you have RUBYOPT=rubygems which is not your case).

HTH,
--
Luis Lavena

Guillermo.Acilu

6/9/2008 7:42:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Thank you Luis.

It worked!

Guillermo





From:
Luis Lavena <luislavena@gmail.com>
To:
ruby-talk@ruby-lang.org (ruby-talk ML)
Date:
09.06.2008 21:25
Subject:
Re: require mysql do not work



On Jun 9, 8:38 pm, Guillermo.Ac...@koiaka.com wrote:
> [Note: parts of this message were removed to make it a legal post.]
>
> Hello guys,
>
> I am new to Ruby. I have been working with the core language so far
> without problems. Now I am starting to use mysql.
>
> I have installed it with gem install mysql, and it work perfectly. If I
> run gem list, I get the following:
>
> sh-3.2# gem list
>
> *** LOCAL GEMS ***
>
> actionmailer (2.1.0, 1.3.6)
> actionpack (2.1.0, 1.13.6)
> actionwebservice (1.2.6)
> activerecord (2.1.0, 1.15.6)
> activeresource (2.1.0)
> activesupport (2.1.0, 1.4.4)
> acts_as_ferret (0.4.3, 0.4.1)
> capistrano (2.3.0, 2.0.0)
> cgi_multipart_eof_fix (2.5.0, 2.2)
> daemons (1.0.10, 1.0.9, 1.0.7)
> dnssd (0.6.0)
> fastthread (1.0.1, 1.0)
> fcgi (0.8.7)
> ferret (0.11.6, 0.11.4)
> gem_plugin (0.2.3, 0.2.2)
> highline (1.4.0, 1.2.9)
> hpricot (0.6)
> libxml-ruby (0.5.4, 0.3.8.4)
> mongrel (1.1.5, 1.1.4, 1.0.1)
> mysql (2.7)
> needle (1.3.0)
> net-scp (1.0.1)
> net-sftp (2.0.1, 1.1.0)
> net-ssh (2.0.2, 1.1.2)
> net-ssh-gateway (1.0.0)
> rails (2.1.0, 1.2.6)
> rake (0.8.1, 0.7.3)
> RedCloth (3.0.4)
> ruby-openid (2.0.4, 1.1.4)
> ruby-yadis (0.3.4)
> rubygems-update (1.1.1)
> rubynode (0.1.5, 0.1.3)
> sqlite3-ruby (1.2.2, 1.2.1)
> termios (0.9.4)
>
> As you can see mysql 2.7 is installed. When I put the line require
"mysql"
> in the first line of my program, I get the following error:
>
> sh-3.2# ruby learn.rb
> learn.rb:1:in `require': no such file to load -- mysql (LoadError)
> from learn.rb:1
>
> I am on Mac OS X 10.5.3 with Ruby 1.8.6, and the outputs included in the
> email have been generated with "root". Any ideas why it is not working?
>

try this:

require 'rubygems'
require 'mysql'

mysql being installed as gem require you first load rubygems to work
(unless you have RUBYOPT=rubygems which is not your case).

HTH,
--
Luis Lavena