Hi, i’m making a web app that use a sqlite database. When i run on my machine from the IDE, it work flawless, loading the db with this code:
[code]
Dim dbFile as FolderItem
dblocale = New SQLiteDatabase
dbFile = GetFolderItem(“myDB.sqlIte”)
System.Log(System.LogLevelError, dbFile.NativePath)
dblocale.DatabaseFile=dbFile
If dblocale.Connect() then
System.Log(System.LogLevelError,“Connected”)
else
System.Log(System.LogLevelError, dblocale.ErrorMessage)
end[/code]
but when i build the app, standalone version and upload it on my server (ubuntu), when i launch i’ve got this error:
Database file doesn’t exist in the specified location
the system log above, write on the ubuntu server, the right path:
/Home/userX/app/myDB.sqlite
so i don’t understand where is the error.
You should probably display dbFile.AbsolutePath in your log message so you can compare it to the actual location of the file. Odds are they do not match.
done, i’ve got the same path, the correct one.
I’m used to put the DBfile into a specific folder:
DATABASE (FOLDER)
See some code extracted from a working project (but is only a code part to be controlled
)
[code]Function Method_FindFolder(name As String) As FolderItem
Dim f as FolderItem = app.ExecutableFile.parent
while f<>nil
Dim d as FolderItem = f.Child(name)
if d<>nil and d.Exists Then
Return d
End if
f = f.Parent
wend
End Function
//============================================
Sub Method_Open_APP()
// DATABASE folder
Dim f as FolderItem = Method_FindFolder(“DATABASE”)
if f = nil Then
f = GetFolderItem("").Parent.Child(“DATABASE”)
f.CreateAsFolder
End if
dbFile = new SQLiteDatabase
Dim ISTRUZIONE As String
Dim r as RecordSet
Dim dbFile as FolderItem
dbFile=f.Child(“DocsTool.db”)
if dbFile.Exists Then
if dbFile.Connect Then
Else
System.DebugLog "database error."
quit
End if
End if
End Sub[/code]
Perhaps it can help you
And dbFile.Exists is True?
Solved, ubuntu doesn’t like the file extension myDB.sqlite as mac os x does, changing it to myDB.db makes the magic, now it works (!!!).