Problems connecting to sqlite database

Hi, I am sure this sort of problem has been dealt with many times before.
The code below is a selection of code I wrote way back in 2014 using XOJO V2.2 on a 32-bit Windows 7 machine. It worked perfectly (and still does) I now use Linux MINT 20.2 64bit and have the latest version of XOJO V1.2 2022. This code was copied over to Linux (along with the actual SQLite database (in the same directory as the app, as per the way I have it on the older Windows machine. My Linux copy now displays an error saying it cannot connect to the database. It compiles OK but displays the error at runtime. The code is identical to what is working on my older 32b Windows machine. I did make sure the architecture was changed to X86 64Bit. Please tell what Might be wrong

dim dbFile as FolderItem
dim db as SQLiteDatabase
dim stuff as RecordSet
dim sql as string
sql = “SELECT * FROM current”

// Establish a connection to the database.

db = New SQLiteDatabase
dbFile = SpecialFolder.CurrentWorkingDirectory.Child(“boxrecords.rsd”)
db.DatabaseFile = dbFile

// Make sure the connection to the database is successful.

if not db.Connect() then
MsgBox “Database connection failed for some stupid reason - like, maybe it’s not there anymore?”
end if

stuff = db.SQLSelect(sql)
DataList.DeleteAllRows() //Clear the list

Ensure that dbFile exists where you think it does:

if dbFile.exists = false then
 msgbox "box records.rsd does not exist where we expect it: " + dbFile.NativePath
 return
end

I also suspect you might have a security issue and that’s why it can’t connect. Generally accessing files right next to the app is ‘bad’ and ‘not possible’ in newer versions of the most OS’s. I believe Windows will still let you but Linux and Mac don’t like that. I forget the term but to keep malicious apps from doing this they make the current app directory path something odd. I would put the database in the specialFolder.ApplicationData directory just to avoid this situation.

Thanks very much. Appreciate your response. How can I find specialFolder.ApplicationData to copy the database to. I can’t seem to find that particular directory anywhere on my system. As a side note - I do have another app accessing a binary stream file in the same directory as the app and it works fine.

@Carl_J_Hood

This documentation should help you

https://documentation.xojo.com/api/files/specialfolder.html

Personally, I would use:

dbFile = app.ExecutableFile.Parent.Child("boxrecords.rsd")