Active Topics

 


Reply
Thread Tools
Posts: 14 | Thanked: 1 time | Joined on Feb 2008
#1
I have nginx, php, python all running on my N800. All work well. The issue is with sqlite. I can read sqlite databases fine both from python scripts and php/nginx. I can create sqlite databases from both, insert data, etc. Problem is when I try to write to an existing sqlite databse file. I get an error about attempting write to a readonly database. File/folder permissions seem to all be set w/ write access.

Any ideas?
 
Posts: 14 | Thanked: 1 time | Joined on Feb 2008
#2
Anyone have suggestions on this? I still do not have a fix for this issue.
 
briand's Avatar
Posts: 566 | Thanked: 145 times | Joined on Feb 2008 @ Tallahassee, FL
#3
you don't have permission, within the database, to update, add, and/or modify. I've not played with SQLITE, so the exact syntax may not be the same (in other words, hit the documentation and read... don't just blindly type this!!), but if you log in as the database administrator account (which should have access to everything), you can grant rights to the other account(s) in the database.

GRANT ALL ON <database> TO <username> IDENTIFIED BY <password> WITH GRANT OPTION;

The username/password is the database username and password, not (necessarily) the system username and password!
 
Posts: 364 | Thanked: 54 times | Joined on Feb 2008
#4
yup, briand is exactly correct. Just like with any real DB there are user 'roles' or permission levels. You will likely need to pass that along to the DB when you open the connection. Some users are 'read only' others are 'add only no modify', some are "sa" or 'sysadmin' level which are full access DB users and so on in various levels depending on how the DB designer setup the access security.

But it is usually all setup within the DB itself and not related to the system userid. Though some DB can work that way, it is doubtful your db was created that way because it's inherently insecure to someone determined to get into the db.
 
brontide's Avatar
Posts: 868 | Thanked: 474 times | Joined on Oct 2007 @ Capital District, NY, USA
#5
In order to write to the database you not only need permission to write to the specific file, but also to the directory it's in ( to create the journal files ). So make sure that you have that permission.
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#6
Unlike MySql, postscript etc. there is no such thing as an admin account for sqlite. Sqlite does not use any login of any description it was designed as an embeddable database system and things like grant and revoke do not make any sense. The only time you are likely to get this error is if you are trying to write to an sqlite2 db with sqlite3.
If it is an sqlite2.x db then use sqlite2.x to export the records then import to a new sqlite3 db ( or just use sqlite2.x )

Rick
 
Posts: 14 | Thanked: 1 time | Joined on Feb 2008
#7
Thanks. will try these. a note: SQLITE does not implement GRANT and REVOKE because they would be meaningless for an embedded database engine.

Will check directory permissions, but is odd that I can create the database the first time, write to it. The failure happens on subsequent attempts to write to the database.
 
Reply


 
Forum Jump


All times are GMT. The time now is 23:18.