How to create a new database in ruby with sqlite3?

Here is what I wrote on my Terminal. I tried different ways of writing
sqlite3 but each time I get an error message.

Would someone know how I should write this code?

1.9.3p362 :002 > require ‘sqlite3’
=> true
1.9.3p362 :003 > $db=SQLite3::Datatbase.new(“dbfile”)
NameError: uninitialized constant SQLite3::Datatbase
from
/Users/hakimbenbekhti/.rvm/gems/ruby-1.9.3-p362/gems/sqlite3-1.3.7/lib/sqlite3/version.rb:19:in
const_missing' from (irb):3 from /Users/hakimbenbekhti/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in
1.9.3p362 :004 > $db = sqlite3::Database.new(“dbfile”)
NameError: undefined local variable or method sqlite3' for main:Object from (irb):4 from /Users/hakimbenbekhti/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in
1.9.3p362 :005 > $db = Sqlite3::Database.new(“dbfile”)
NameError: uninitialized constant Sqlite3
from (irb):5
from /Users/hakimbenbekhti/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in
`’

Subject: How to create a new database in ruby with sqlite3?
Date: dom 24 feb 13 11:04:09 +0900

Quoting Hakim B. ([email protected]):

1.9.3p362 :003 > $db=SQLite3::Datatbase.new(“dbfile”)

What about writing ‘Database’ instead of ‘Datatbase’?

Carlo

Carlo E. Prelz wrote in post #1098778:

Subject: How to create a new database in ruby with sqlite3?
Date: dom 24 feb 13 11:04:09 +0900

Quoting Hakim B. ([email protected]):

1.9.3p362 :003 > $db=SQLite3::Datatbase.new(“dbfile”)

What about writing ‘Database’ instead of ‘Datatbase’?

Carlo

Yep, nothing more than that. How stupid…It will teach me to be more
patient and careful next time!
Thanks Carlo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs