# SQLite3::SQLException: unable to open database file

**URL:** <https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485>\
**Category:** Rails\
**Created:** [April 26, 2009, 12:26am UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485 "2009-04-26T00:26:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![serenobs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@serenobs](https://www.ruby-forum.com/u/serenobs)\
**Post date:** [April 26, 2009, 12:26am UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485/1 "2009-04-26T00:26:38Z")

</div>

Hi.  
I was trying to code same as the rails guide : getting started.  
I could follow steps to 6.3 Working with Posts in the Browser.  
(setting home page, creating a resource, running a migration)

After clicked create button, errors are occured.  
SQLite3::SQLException: unable to open database file: INSERT INTO  
“posts” (“name”, “created\_at”, “title”, “updated\_at”, “content”) VALUES  
(‘123123123’, ‘2009-04-25 22:23:51’, ‘12312312’, ‘2009-04-25  
22:23:51’, ‘4123123123’)

There is a db file at db folder named development.sqlite3  
what’s wrong with me?  
Somebody help me, please.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![serenobs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@serenobs](https://www.ruby-forum.com/u/serenobs)\
**Post date:** [April 26, 2009, 2:56am UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485/2 "2009-04-26T02:56:08Z")

</div>

serenobs wrote:

> There is a db file at db folder named development.sqlite3

What does it say?

---

<div class="post-metadata">

**Author:** ![serenobs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@serenobs](https://www.ruby-forum.com/u/serenobs)\
**Post date:** [April 26, 2009, 3:08am UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485/3 "2009-04-26T03:08:53Z")

</div>

serenobs wrote:

> what’s wrong with me?  
> Somebody help me, please.

Also, looking over the directions in the guide, this part is plain  
wrong:

* * *

3.3.1 Configuring a SQLite Database  
…  
…

If you donâ€™t have any database set up, SQLite is the easiest to get  
installed. If youâ€™re on OS X 10.5 or greater on a Mac, you already have  
it. Otherwise, you can install it using RubyGems:

## $ gem install sqlite3-ruby

That does not install sqlite3. That installs a ruby interface to a  
pre-existing installation of sqlite3. In other words, that gem provides  
the means for ruby to talk to sqlite3. As the guide says at the  
beginning:

* * *

1 This Guide Assumes

This guide is designed for beginners who want to get started with a  
Rails application from scratch. It does not assume that you have any  
prior experience with Rails. However, to get the most out of it, you  
need to have some prerequisites installed:

## The Ruby language The RubyGems packaging system A working installation of SQLite (preferred), MySQL, or PostgreSQL

Did you have a working installation of SQLite installed before you  
started reading the guide?

---

<div class="post-metadata">

**Author:** ![serenobs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@serenobs](https://www.ruby-forum.com/u/serenobs)\
**Post date:** [April 26, 2009, 5:09pm UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485/4 "2009-04-26T17:09:42Z")

</div>

Of course ruby, ruby gems and sqlite3 are installed on my system  
(CentOS 5.3)

#gem install sqlite3-ruby  
Building native extensions. This could take a while…  
Successfully installed sqlite3-ruby-1.2.4  
1 gem installed  
Installing ri documentation for sqlite3-ruby-1.2.4…  
Installing RDoc documentation for sqlite3-ruby-1.2.4…

it is installed properly, isn’t it?  
I can execute irb shell(ruby), sqlite3.

On Apr 26, 10:08 am, 7stud – [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![serenobs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@serenobs](https://www.ruby-forum.com/u/serenobs)\
**Post date:** [August 24, 2009, 7:48pm UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485/5 "2009-08-24T19:48:32Z")

</div>

serenobs wrote:

> SQLite3::SQLException: unable to open database file…

Me thinks it’s a permissions issue…

[http://www.nigelthorne.com/2008/07/activerecord-sqlite3-unable-to-open.html](http://www.nigelthorne.com/2008/07/activerecord-sqlite3-unable-to-open.html)

---

<div class="post-metadata">

**Author:** ![serenobs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@serenobs](https://www.ruby-forum.com/u/serenobs)\
**Post date:** [April 26, 2009, 8:14pm UTC](https://www.ruby-forum.com/t/sqlite3-unable-to-open-database-file/166485/6 "2009-04-26T20:14:10Z")

</div>

On Apr 26, 12:25 am, serenobs [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
.  
.

> There is a db file at db folder named development.sqlite3  
> what’s wrong with me?  
> Somebody help me, please.

Did your migration complete successfully? i.e. does the table posts  
exist in your database?  
Does your database.yml file point to your db file -  
development.sqlite3? It should look something like this:  
development:  
adapter: sqlite3  
database: db/development.sqlite3  
pool: 5  
timeout: 5000
