mardi 22 décembre 2015

Not able to open SQLite3 database using Ruby program

I am working on a simple program where I need to open my Sqlite3 database by writing Ruby code but I am getting the following error on executing it: 'initialize': unable to open database file(Sqlite£:CantOpenException) from first.rb:4:in 'new' from first.rb:4:in ''

The code is here:

require "sqlite3"

# Open a database
db = SQLite3::Database.open "C:\Users\aroraku\Desktop\SQL\adaptive.db"


# Find a few rows
db.execute( "
Select count(uuid) as RegistredPeopleNo, strftime('%Y-%m',created_at) AS Month
from users
group by strftime('%Y-%m',created_at)
order by Month;" ) do |row|
  p row
end

Can someone please help me with this problem. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire