Topic: SQLite3 on debian

what I pleasure I have today....

I am moving a working app from 1 server to another.
its my first time on debian, but I installed it on plenty of linux/bsd before.

its a custom app made my me which use sqlite3 as his database backend. nothing fancy.

root@apache:/var/www# ./script/console
Loading development environment.
Bag.count
>> Bag.count
NameError: uninitialized constant SQLite3::Driver::Native::API
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in `const_missing'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `send'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `const_missing'
        from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/driver/native/driver.rb:81:in `open'
        from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:111:in `initialize'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:17:in `new'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:17:in `sqlite3_connection'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `send'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `connection_without_query_cache='
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_cache.rb:54:in `connection='
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in `retrieve_connection'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:696:in `columns'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:216:in `column_for'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:138:in `calculate'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:66:in `count'
        from (irb):1
>>

so I am getting this beautiful error

NameError: uninitialized constant SQLite3::Driver::Native::API

WHY ? I really don't get this one ... WHY?

I have sqlite3.3.8 installed
i got swig installed then and sqlite3-ruby

Re: SQLite3 on debian

Out of curiosity, try calling this before Bag.count. Maybe the gem isn't getting loaded for some reason.

require 'sqlite3'

Railscasts - Free Ruby on Rails Screencasts

Re: SQLite3 on debian

debian includes a lot of small packages for ruby and everything

[sepulveda] ~$ dpkg -l | grep sqlite
ii  libdbd-sqlite3 1.08-1         Perl DBI driver with a self-contained RDBMS
ii  libsqlite0     2.8.16-1       SQLite shared library
ii  libsqlite0-dev 2.8.16-1       SQLite development files
ii  libsqlite3-0   3.2.1-1        SQLite 3 shared library
ii  libsqlite3-dev 3.2.1-1        SQLite 3 development files
ii  python-sqlite  1.0.1-2        python interface to SQLite
ii  sqlite         2.8.16-1       command line interface for SQLite
ii  sqlite3        3.2.1-1        A command line interface for SQLite 3
[sepulveda] ~$ dpkg -l | grep ruby
ii  eruby          1.0.5-1        Embedded Ruby Language
ii  libactiverecor 1.14.4-1       Activerecord rubygem
ii  libactivesuppo 1.3.1-1        activesupport rubygem
ii  libdbi-ruby    0.0.23-2       Database Independent Interface for Ruby
ii  libdbi-ruby1.8 0.0.23-2       Database Independent Interface for Ruby 1.8
ii  libdbm-ruby1.8 1.8.2-7sarge4  DBM interface for Ruby 1.8
ii  liberuby       1.0.5-1        Library for eruby
ii  libexif-ruby1. 0.1.2-6        EXIF tag parsing Library for ruby1.8
ii  libfcgi-ruby1. 0.8.6-1        FastCGI library for Ruby
ii  libgdbm-ruby1. 1.8.2-7sarge4  GDBM interface for Ruby 1.8
ii  libhttp-access 2.0.4-1        HTTP accessing library for ruby
ii  libhttp-access 2.0.4-1        HTTP accessing library for ruby
ii  liblog4r-ruby1 1.0.5-3        A logging library for Ruby
ii  libmysql-ruby  2.4.5-6.1      MySQL module for Ruby
ii  libmysql-ruby1 2.4.5-6.1      MySQL module for Ruby 1.8
ii  libmysql-rubyg 2.7-1          MySQL/Ruby gem
ii  librails-rubyg 1.1.6-1        Ruby on Rails
ii  librake-rubyge 0.7.1-1        Rake Rubygem
ii  librdf-ruby    1.0.0.2-1      Ruby 1.8 language bindings for the Redland R
ii  libruby        1.8.2-1        Libraries necessary to run Ruby 1.8.x
ii  libruby1.8     1.8.2-7sarge4  Libraries necessary to run Ruby 1.8
ii  ndn-rubygems   1.12-1         DreamHost pre-installed rubygems.
ii  rdoc           1.8.2-1        Generate documentation from ruby source file
ii  ruby           1.8.2-1        An interpreter of object-oriented scripting
ii  ruby1.8        1.8.2-7sarge4  Interpreter of object-oriented scripting lan
ii  ruby1.8-dev    1.8.2-7sarge4  Header files for compiling extension modules
ii  rubygems       0.8.10-3       RubyGems
[sepulveda] ~$

I decided to give up, and removed all debian packages related to sqlite and ruby and installed it from sources.

so far so good.