Ruby sqlite/gem error: Could not load sqlite adapter

Discussion in 'Ruby' started by jhs408@gmail.com, Apr 16, 2009.

  1. Guest

    The sample "c:\tmp'Test_sqlite.rb" generates the error: Could not
    load sqlite adapter,
    Yet, when the example is executed in the sqlite3-ruby directory, no
    error occur.

    Any suggestion or changes to the sample to resolve the error.

    Thanks for the help,
    John
    ------------------------------------
    Windows XP SP3
    Using ruby 1.8.7, gem 1.3.2, sqlite3-ruby 1.2.4, sqlite3
    product
    Environment set: RUBYOPT=rubygems
    PATH=c:\tools\sqlite3 ...

    -----running sample----> c:\tmp\test_sqlite.rb --------------
    require 'sequel'
    DB = Sequel.sqlite("test-sequel.db")
    # create an items table
    DB.create_table :items do
    primary_key :id
    column :name, :text
    column :price, :float
    end
    # create a dataset from the items table
    items = DB[:items]
    # populate the table
    items << {:name => 'abc', :price => rand * 100}
    items << {:name => 'def', :price => rand * 100}
    items << {:name => 'ghi', :price => rand * 100}
    # print out the number of records
    puts "Item count: #{ items.count }"
    # print out the records in descending order by price
    items.reverse_order:)price).print
    # print out the average price
    puts "The average price is: #{ items.avg :price }"

    ------Error Msg----
    C:\tmp>test_sequel.rb
    C:/ruby/lib/ruby/gems/1.8/gems/sequel-2.11.0/lib/sequel_core/
    database.rb:105:in `adapter_class': Could not load sqlite a
    dapter: (Sequel::Error::AdapterNotFound)
    no such file to load -- sqlite3
    from C:/ruby/lib/ruby/gems/1.8/gems/sequel-2.11.0/lib/
    sequel_core/database.rb:141:in `connect'
    from C:/ruby/lib/ruby/gems/1.8/gems/sequel-2.11.0/lib/
    sequel_core.rb:68:in `connect'
    from C:/ruby/lib/ruby/gems/1.8/gems/sequel-2.11.0/lib/
    sequel_core.rb:157:in `adapter_method'
    from (eval):1:in `sqlite'
    from C:/tmp/test_sequel.rb:7
    , Apr 16, 2009
    #1
    1. Advertising

  2. Ben Lovell Guest

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

    On Thu, Apr 16, 2009 at 4:10 PM, <> wrote:

    > The sample "c:\tmp'Test_sqlite.rb" generates the error: Could not
    > load sqlite adapter,
    > Yet, when the example is executed in the sqlite3-ruby directory, no
    > error occur.
    >
    > Any suggestion or changes to the sample to resolve the error.
    >


    I may be mistaken but I'm pretty sure you have to put the sqlite3.dll (or
    other binaries depending on your version) in your c:\windows\system32
    directory. Give that a try.

    Ben
    Ben Lovell, Apr 16, 2009
    #2
    1. Advertising

  3. Guest

    On Apr 16, 9:26 am, Ben Lovell <> wrote:
    > [Note:  parts of this message were removed to make it a legal post.]
    >
    > On Thu, Apr 16, 2009 at 4:10 PM, <> wrote:
    > > The sample  "c:\tmp'Test_sqlite.rb"   generates the error: Could not
    > > load sqlite adapter,
    > > Yet, when the example is executed in the sqlite3-ruby directory,  no
    > > error occur.

    >
    > > Any suggestion or changes to the sample to resolve the error.

    >
    > I may be mistaken but I'm pretty sure you have to put the sqlite3.dll (or
    > other binaries depending on your version) in your c:\windows\system32
    > directory. Give that a try.
    >
    > Ben


    Ben,

    The sqlite3.dll is located in a directory located in the PATH.
    It appears that rubygems is not able to locate sqlite.rb in the
    directory:C:\Ruby\lib\ruby\gems\1.8\gems\sequel-2.12.0\lib\sequel
    \adapters
    when the sample is executed from c:\tmp

    Yet when I place the sample in the directory:
    C:\Ruby\lib\ruby\gems\1.8\gems\sequel-2.12.0
    the sample program executes correctly.

    Which leads me to conclude that rubygem is having a problem.

    John
    , Apr 16, 2009
    #3
  4. Ben Lovell Guest

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

    On Thu, Apr 16, 2009 at 11:45 PM, <> wrote:
    >
    >
    > The sqlite3.dll is located in a directory located in the PATH.
    > It appears that rubygems is not able to locate sqlite.rb in the
    > directory:C:\Ruby\lib\ruby\gems\1.8\gems\sequel-2.12.0\lib\sequel
    > \adapters
    > when the sample is executed from c:\tmp
    >
    > Yet when I place the sample in the directory:
    > C:\Ruby\lib\ruby\gems\1.8\gems\sequel-2.12.0
    > the sample program executes correctly.
    >
    > Which leads me to conclude that rubygem is having a problem.
    >
    > John
    >
    >

    Ah, just a hunch but are you certain this isn't an issue with permissions?
    Try running it from an elevated command prompt if you haven't already.
    Ben Lovell, Apr 17, 2009
    #4
  5. Guest

    On Apr 17, 2:30 am, Ben Lovell <> wrote:
    > [Note:  parts of this message were removed to make it a legal post.]
    >
    >
    >
    > On Thu, Apr 16, 2009 at 11:45 PM, <> wrote:
    >
    > > The sqlite3.dll is located in a directory located in the PATH.
    > > It appears that rubygems is not able to locate sqlite.rb in the
    > > directory:C:\Ruby\lib\ruby\gems\1.8\gems\sequel-2.12.0\lib\sequel
    > > \adapters
    > > when the sample is executed from c:\tmp

    >
    > > Yet when I place the sample in the directory:
    > > C:\Ruby\lib\ruby\gems\1.8\gems\sequel-2.12.0
    > > the sample program executes correctly.

    >
    > > Which leads me to conclude that rubygem is having a problem.

    >
    > > John

    >
    > Ah, just a hunch but are you certain this isn't an issue with permissions?
    > Try running it from an elevated command prompt if you haven't already.


    Sample problem was run in the directory c:\tmp in a command window
    with admin privilage. I am beginning to suspect that there is
    a rubygem problem with something specified in this example or sequel
    gem which
    caused the error message.

    Maybe the rubygem developers might have an idea.
    Appreciate the help.
    John
    , Apr 18, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carl Youngblood
    Replies:
    1
    Views:
    212
    Carl Youngblood
    Apr 9, 2005
  2. Jim Freeze
    Replies:
    6
    Views:
    154
    Chad Fowler
    May 13, 2005
  3. han
    Replies:
    1
    Views:
    116
    Lyle Johnson
    Oct 24, 2005
  4. Sam Smoot
    Replies:
    4
    Views:
    131
    Sam Smoot
    Oct 20, 2006
  5. Austin 7873
    Replies:
    5
    Views:
    176
    Eric Hodel
    Jan 27, 2007
Loading...

Share This Page