PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > require mysql do not work
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
require mysql do not work

Réponse
 
LinkBack Outils de la discussion
Vieux 09/06/2008, 19h38   #1
Guillermo.Acilu@koiaka.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut require mysql do not work

[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

  Réponse avec citation
Vieux 09/06/2008, 20h04   #2
Luis Lavena
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: require mysql do not work

On Jun 9, 8:38pm, 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
  Réponse avec citation
Vieux 09/06/2008, 20h42   #3
Guillermo.Acilu@koiaka.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: require mysql do not work

[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



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h01.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10979 seconds with 11 queries