Forum: Ruby require sqlite?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E3513c4edd6810bb4b9914b58da2a2c3?d=identicon&s=25 Jamal Soueidan (jamal)
on 2008-10-20 09:08
Hi,

I wonder why I cannot require sqlite in my ruby app.

$ ruby app.rb
app.rb:3:in `require': no such file to load -- sqlite3 (LoadError) from
app.rb:3

But it's working in the console? that's weird!

>> require 'sqlite3'
=> true

What can be the problem?

Thanks :)
76caedd87445c17860358841ae0de620?d=identicon&s=25 Lars Christensen (Guest)
on 2008-10-20 09:25
(Received via mailing list)
On Oct 20, 9:07 am, Jamal Soueidan <ja...@soueidan.com> wrote:
> I wonder why I cannot require sqlite in my ruby app.
> What can be the problem?

I guess you have it installed as a gem. Try either:

require 'rubygems'
require 'sqlite3'

or the RUBYOPT environment set:

$ export RUBYOPT=-rubygems
8249300874320f7de3a83d4dc614d571?d=identicon&s=25 Bernie Loriaga (bernie_loriaga)
on 2008-10-20 09:33
Jamal Soueidan wrote:
> Hi,
>
> I wonder why I cannot require sqlite in my ruby app.
>
> $ ruby app.rb
> app.rb:3:in `require': no such file to load -- sqlite3 (LoadError) from
> app.rb:3
>
> But it's working in the console? that's weird!
>
>>> require 'sqlite3'
> => true
>
> What can be the problem?
>
> Thanks :)

I hope this can solve your problem...
http://sqlite-ruby.rubyforge.org/

Good day,
Bernie Loriaga
E3513c4edd6810bb4b9914b58da2a2c3?d=identicon&s=25 Jamal Soueidan (jamal)
on 2008-10-20 11:08
Lars Christensen wrote:
> On Oct 20, 9:07�am, Jamal Soueidan <ja...@soueidan.com> wrote:
>> I wonder why I cannot require sqlite in my ruby app.
>> What can be the problem?
>
> I guess you have it installed as a gem. Try either:
>
> require 'rubygems'
> require 'sqlite3'
>
> or the RUBYOPT environment set:
>
> $ export RUBYOPT=-rubygems

Thanks, that fixed my problem :)
This topic is locked and can not be replied to.