No such file to load -- mysql (LoadError)

Hi! I am new to Ruby and just installed RadRails and also did gem
install mysql and specifiled the path as
C:\Ruby\lib\ruby\gems\1.8\gems\mysql-2.7.3-x86-mswin32\ext
when i run the following:

require 'mysql'
if __FILE__ == $0
  # TODO Generated stub
print "Hello\n"
end

I am getting the following error
test1.rb:4:in `require': no such file to load -- mysql (LoadError)
  from test1.rb:4

Can someone please help? I've looked at available posts and could not
find a solution... have been trying to find a solution to this
problem for 2 days but not getting anywhere. Any help is much
appreciated.

Thanks.
Ani

···

--
Posted via http://www.ruby-forum.com/.

You're running 1.8 so you need to add "require 'rubygems'" before your "require 'mysql'" line.

···

On Nov 8, 2010, at 19:52 , Ani T. wrote:

Hi! I am new to Ruby and just installed RadRails and also did gem
install mysql and specifiled the path as
C:\Ruby\lib\ruby\gems\1.8\gems\mysql-2.7.3-x86-mswin32\ext
when i run the following:

require 'mysql'
if __FILE__ == $0
# TODO Generated stub
print "Hello\n"
end

I am getting the following error
test1.rb:4:in `require': no such file to load -- mysql (LoadError)
from test1.rb:4

Hi Ryan, Thanks for your post.

I inserted "require 'rubygems'" and am now getting the following error:
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so:
126: The specified module could not be found. -
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so
(LoadError)
  from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
  from test1.rb:4

I checked the locatins above and the mysql.so and custom_require.rb
files exist...not sure why it is giving the error...thanks in advance
for your help. I've attached screenshots incase it is helpful.

Ani

Attachments:
http://www.ruby-forum.com/attachment/5324/1-ruby.JPG
http://www.ruby-forum.com/attachment/5325/2-ruby.JPG
http://www.ruby-forum.com/attachment/5326/3-ruby.JPG
http://www.ruby-forum.com/attachment/5327/4-ruby.jpg

···

--
Posted via http://www.ruby-forum.com/.

"Ani T." <ani.tekawade@gmail.com> wrote in message news:530f7d0fe5605ca667f48ecf39046632@ruby-forum.com...

Hi Ryan, Thanks for your post.

I inserted "require 'rubygems'" and am now getting the following error:
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so:
126: The specified module could not be found. -
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so
(LoadError)
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
from test1.rb:4

I checked the locatins above and the mysql.so and custom_require.rb
files exist...not sure why it is giving the error...thanks in advance
for your help. I've attached screenshots incase it is helpful.

Ani

Hello Ani:

This might not make a difference but is the location of the "libmySQL.dll" file (usually the mysql/bin folder) in your systems $PATH environment variable. I haven't tried using MYSQL with Ruby but recently on Windows Vista 64 when developing with Delphi XE I've noticed that the mysql dll needs to be in the $PATH variable. In the old days I could drop that dll into the application folder but that doesn't seem to work for me anymore so you might be experiencing the same thing.

Michael