Attempt to write a readonly databae

I am writing a double-opt-in registration routine. An incoming reply email is supposed to trigger an update to the database. I am getting this error:

'log': SQLite3::SQLException: attempt to write a readonly database: UPDATE    "members" SET "double_opt_in" = 'OK', "updated_at" = '2009-12-13 19:54:56'    WHERE "id" = 24

It seems very likely that the relevant process doesn't have permissions to write to the database. That's not too surprising since the database is owned by a particular user. However, all of my other Rails methods have no problem writing to the database. So, I'm a bit perplexed. More importantly, before I go off changing permissions on the database, I'm wondering if anyone has any insight on what's going on here, why I would suddenly be seeing this issue and what the appropriate fix should be.

Thanks for any input.

          ... doug

an incoming reply email

how do you "handle" the incoming reply emails? Via cron-job?

However, all of my other Rails methods have no problem writing to the database

well they all run within the same mongrel-process (I guess)...

how do you "handle" the incoming reply emails? Via cron-job?

Incoming emails are processed immediately by a model method. That is, when the incoming email arrives the model method converts it to a TMail::Mail object which is assigned to a variable. Relevant data is extracted from that variable and then an attempt is made to write that data to the database. It is that write to the database that is being blocked.

well they all run within the same mongrel-process (I guess)...

I don't know whether it's relevant; but, I'm running passenger.

Thanks for the input.

          ... doug

I'd guess that whatever's handing the mail off to the model method isn't running as the same user as the webserver; you may want to look into that.

--Matt Jones

I'd guess that whatever's handing the mail off to the model method isn't running as the same user as the webserver; you may want to look into that.

I was able to fix the problem by making the database writeable by the user that the smtp server was running as. It works just fine. I just get nervous when I have to expand the write permissions on the database. Basically, I'm thinking that I'm probably missing something. In this case, maybe not. Thanks for the input.

          ... doug

I wanted to correct an error that I made in a prior post just in case anyone is or will be following this. My fix was to make the database writable by the user, "nobody" rather than the user the smtp server was running as. Sorry for the mis-spoke.

         ... doug