readonly databaseError Code:8

I have this error on Linux with cgi on windows works perfect (Xojo 2014r3)
Error attempt to write a readonly databaseError Code:8

is the database actually marked as read write in the file system ?
can you actually write to the directory where its located ?

yes

this is my code for open the Db (Sqlite)

Dim Rs As RecordSet

DbMain=New REALSQLDatabase
DbMain.MultiUser=True

#If TargetWin32 then
#if DebugBuild then
DbMain.DatabaseFile = GetFolderItem(“C:\ADG\adgdb.db”)
#ELSE
DbMain.DatabaseFile = GetFolderItem(“C:\ADG\adgdb.db”)
#endif
#Else
DbMain.DatabaseFile = GetFolderItem(“adgdb.db”)
#endif

if DbMain.Connect() = false then
MsgBox"DataBase no Found or DataBase Error"
Return False
Else
Return True
end if

log in to the linux box & do
ls -al
in the dir where the database is

sqlite doesn’t tell you its read only if there’s not a reason

hi
with ls -al what i am looking for

i use 755 permission

ownership would be important
if the db is owned by one person and the app run by a different user then the 755 means RWX for the OWNER and group & others can READ - hence locked DB if you try to write

so change to 777 for Db and the App

i change to 777 and now have error Code:14

I suspect what you want is 666. Setting the executable bit is probably the error.

same error code:14

do an LS -AL on that directory
post the results
change up one dir ( cd …)
do an LS -AL on that directory
post the results

------- App Folder --------
total 4896
drwxr-xr-x 4 root root 4096 Dec 18 07:16 .
drwxrwxrwx 6 root root 4096 Dec 18 07:15 …
-rwxr-xr-x 1 root root 86 Dec 18 00:35 .htaccess
drwxr-xr-x 3 root root 4096 Dec 18 00:35 Resources
-rwxr-xr-x 1 root root 4950549 Dec 18 00:36 adg
drwxr-xr-x 2 root root 4096 Dec 18 00:33 adg Libs
-rwxr-xr-x 1 root root 7023 Dec 18 00:35 adg.cgi
-rw-rw-rw- 1 root root 28672 Dec 17 23:26 adgdb.db
-rwxrwxrwx 1 root root 51 Dec 18 00:38 config.cfg
-rw-r–r-- 1 root root 0 Dec 18 07:16 test2

------ www folder -------------------------
total 28
drwxrwxrwx 6 root root 4096 Dec 18 07:15 .
drwxr-xr-x 14 root root 4096 Nov 29 17:30 …
-rw-r–r-- 1 root root 86 Nov 18 23:36 .htaccess
drwxr-xr-x 4 root root 4096 Dec 18 00:35 adg
drwxr-xr-x 4 root root 4096 Nov 19 20:03 alexweb
drwxrwxrwx 2 root root 4096 Nov 19 22:08 cgi-bin
drwxrwxrwx 2 root root 4096 Nov 18 02:22 html

And I’d bet money that www, not root, runs the app so it’s READ only
Making everything 666 would probably make it all “work” but thats a really bad idea

Except the .htaccess file - it needs to probably be 777

BUT changing the ownership so the WWW user owns everything would mean that you could have the permissions turned down more tightly

hi Norman i make the changes and same error code:14

if any steps to do this i am the only one have this problems

if any bug on XOJO

total 56
drwxr-xr-x 14 root root 4096 Dec 18 14:20 .
drwxr-xr-x 21 root root 4096 Oct 21 20:09 …
drwxr-xr-x 2 root root 4096 Oct 21 20:09 backups
drwxr-xr-x 15 root root 4096 Nov 29 17:29 cache
drwxrwsrwt 2 root whoopsie 4096 Nov 29 17:29 crash
-rw-r–r-- 1 root root 0 Nov 18 02:19 firstboot-updated
drwxr-xr-x 57 root root 4096 Dec 17 23:58 lib
drwxrwsr-x 2 root staff 4096 Oct 21 20:09 local
lrwxrwxrwx 1 root root 9 Nov 18 02:19 lock -> /run/lock
drwxrwxr-x 13 root syslog 4096 Dec 18 13:51 log
drwxrwsr-x 2 root mail 4096 Oct 21 20:09 mail
drwxrwsrwt 2 root whoopsie 4096 Nov 29 17:30 metrics
drwxr-xr-x 2 root root 4096 Oct 21 20:09 opt
lrwxrwxrwx 1 root root 4 Nov 18 02:19 run -> /run
drwxr-xr-x 9 root root 4096 Dec 17 23:58 spool
-rw-r–r-- 1 root root 0 Dec 18 14:31 text02
drwxrwxrwt 2 root root 4096 Dec 18 13:55 tmp
drwxrwxrwx 6 root root 4096 Dec 18 07:15 www

SQlite needs that your user have access to write in the folder too, not just the DB file. Check which is your active user running your app. Give it proper access to the folder and DB file.

thanks all
i found the problem now works the folder in www need 777 to works and the change the others files to 775 and db 666

It’s still a very good idea to change the owner and group to something other than root.

http://stackoverflow.com/questions/1122885/why-cant-dbdsqlite-insert-into-a-database-through-my-perl-cgi-script

thanks Tim
i going to do it after i test the app complete