B4J Question SQLite_Error get values from server

Nilzzz

Member
Licensed User
Longtime User
Hello B4J Community,
i had make an app which can downloads values from my B4J server. Everything works fine. I can add values to my DB to my server but when i want to get the values from my DB i receive this error.
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "Values": syntax error)

I don´t know why.

this is my Handler code from my server where i want read the values from my DB.

Code: Copy
Sub Handle(req As ServletRequest, resp As ServletResponse)
    Dim mString As String
   
    If File.Exists(File.DirApp, Main.fileName) = False Then
        mString = "EMPTY"
    Else
   
        Dim liste As List
        liste.Initialize
        liste = File.ReadList(File.DirApp, Main.fileName)
        id = liste.Get(0)
   
        If id < 15 Then
   
            Dim liste As List
            liste.Initialize
            liste = DBUtils.ExecuteMemoryTable(Main.SQL1, "SELECT Values, Date FROM SDatas ORDER BY Date", Null, 0)
            mString = Werkzeug.CodedValues(liste)
       
        Else If id > 15 Then
       
            Dim lastID As Int
            lastID = id
            Dim liste As List
            liste.Initialize
            liste = DBUtils.ExecuteMemoryTable(Main.SQL1, "SELECT Values, Date FROM SDatas WHERE ID BETWEEN" & (lastID - 15) & "AND" & lastID, Null, 0)
            mString = Werkzeug.CodedValues(liste)
   
        End If
       
    End If
   
    Log("Der Übertragene String lautet: " & mString)
    resp.ContentType = "varchar/list"
    resp.Write(mString)

End Sub

Everything works fine until i do the Sub ExecuteMemoryTable. I had another Version of this Server doing the same (Same Query) and it works, so do anyone see my issue??

Thanks for your help
 
Thank you Erel,
but i still have this issues that i get this Error: java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "Values": syntax error)

The database exists! If i do this query "SELECT * From SDatas" everything works fine. But when i just want the columns Values and Date with this query "SELECT Values, Date FROM SDatas" i got the Error message again.
 
Upvote 0
Back
Top