# Strangeness with ruby-web and sqlite3

**URL:** <https://www.ruby-forum.com/t/strangeness-with-ruby-web-and-sqlite3/98680>\
**Category:** Ruby\
**Created:** [July 17, 2006, 2:28pm UTC](https://www.ruby-forum.com/t/strangeness-with-ruby-web-and-sqlite3/98680 "2006-07-17T14:28:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harold\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6de8d8/32.png) [@Harold\_H](https://www.ruby-forum.com/u/Harold_H)\
**Post date:** [July 17, 2006, 2:28pm UTC](https://www.ruby-forum.com/t/strangeness-with-ruby-web-and-sqlite3/98680/1 "2006-07-17T14:28:14Z")

</div>

Hello everyone,

I’m getting everything up and running on win32 with ruby-web and  
sqlite3. I’ve gotten quite far and everything was going even smoother  
than expected until I ran into the strangeness I’m seeing now and I  
just can figure out whats going on.

From my .rb cgi script I can select from the db just fine by doing  
things like:

```
db = SQLite3::Database.new( "test1" )
$theUsers = db.execute( "select * from users" )
db.close

```

But, when I try to insert or delete by doing something like:

```
db = SQLite3::Database.new( "test1" )
db.execute( "insert into users values( 5, 'Harold' )" )
db.close

```

or:

```
db = SQLite3::Database.new( "test1" )
db.execute( "delete from users where id = 2" )
db.close

```

It raises the following exception:  
SQLite3::SQLException  
SQL logic error or missing database

This is highly befuddling to me because all of my interactions with  
the database work fine in irb, that is to say that the lines of code  
that are failing when run as a cgi under ruby-web don’t fail (read:  
work) when typed in by hand to irb. I’ve been able to insert and  
delete like a mad man by hand, but when the web-app tries it it fails.

Anyone heard of or seen anything like this before?

Thanks in advance,  
-Harold

---

<div class="post-metadata">

**Author:** ![Harold\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6de8d8/32.png) [@Harold\_H](https://www.ruby-forum.com/u/Harold_H)\
**Post date:** [July 17, 2006, 3:21pm UTC](https://www.ruby-forum.com/t/strangeness-with-ruby-web-and-sqlite3/98680/2 "2006-07-17T15:21:07Z")

</div>

Hi Harold,

just a guess: is your html-server account allowed to write  
that database file?

cheers

Simon

---

<div class="post-metadata">

**Author:** ![Harold\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6de8d8/32.png) [@Harold\_H](https://www.ruby-forum.com/u/Harold_H)\
**Post date:** [July 17, 2006, 3:37pm UTC](https://www.ruby-forum.com/t/strangeness-with-ruby-web-and-sqlite3/98680/3 "2006-07-17T15:37:04Z")

</div>

Man, good guess.

Thanks a million!

-Harold
