Are the permissions on the file set right? What happens if you try to
access the file with rhe sqlite3 command line tool and run the query
yourself?

-- Eric

On Tue, Jun 9, 2009 at 6:35 AM, Dave Everitt<dever...@innotts.co.uk> wrote:
> Any feedback appreciated on the following. My most recent attempt to
> identify the issue is a minimal Ruby/SQLite/ActiveRecord script, Pastied
> here: http://pastie.textmate.org/492514 which brings up the following when
> run from the command line (an empty database file already exists):
>
> $ ./simple_db.rbx
> [SNIP]/active_record/connection_adapters/sqlite3_adapter.rb:29:in
> `table_structure': Could not find table 'users'
> (ActiveRecord::StatementInvalid)
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/object/misc.rb:39:in
> `returning'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:28:in
> `table_structure'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:213:in
> `columns'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1276:in
> `columns'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3008:in
> `attributes_from_column_definition_without_lock'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/locking/optimistic.rb:66:in
> `attributes_from_column_definition'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2435:in
> `initialize'
>        from ./simple_db.rbx:10:in `new'
>        from ./simple_db.rbx:10
>
> The adapted blog example code I want to run for my students as an example is
> Pastied at: http://pastie.org/492517 so I'd appreciate the identification of
> any glaring errors (currently Camping 1.5 under plain CGI):
>
> The errors in the server log read:
> [SNIP]/activerecord-2.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:212:in
> `log': SQLite3::SQLException: unable to open database file: CREATE TABLE
> "blogtiny_schema_infos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
> "version" float)  (ActiveRecord::StatementInvalid)
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in
> `execute'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:402:in
> `catch_schema_changes'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in
> `execute'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in
> `create_table'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:352:in
> `send'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:352:in
> `method_missing'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:328:in
> `say_with_time'
>        from /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:328:in
> `say_with_time'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb:348:in
> `method_missing'
>        from (eval):71:in `create_schema'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/schema.rb:43:in
> `instance_eval'
>        from
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/schema.rb:43:in
> `define'
>        from (eval):70:in `create_schema'
>        from /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx:71:in
> `create'
>        from /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx:77
> [Thu May 28 12:18:13 2009] [error] [client 127.0.0.1] malformed header from
> script. Bad header=-- create_table("blogtiny_sche:
> /Users/deveritt/Sites/cgi-bin/camping/blogtiny.rbx
>
> Note the odd truncation of 'blogtiny_sche' in the final line.
>
> And one dumb question:
> I don't have to 'require sqlite3-ruby', right?
>
> Dave
>
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to