B4J Question sqlite exception in Raspberry PI2

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

My application run in windows7 is ok but i run in debian8 have following exception ?

Exception : org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V

current us sqlite --->>> #AdditionalJar: sqlite-jdbc-3.8.10.1
 

billzhan

Active Member
Licensed User
Longtime User
Please post the full log / code.

What is the SQlite DB path? Is the SQlite db path available(read/write) on debian8?
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
It's OK, I forget make a "temp" directory together ! :mad:
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I put gsmgateway.db3 with app.jar in same directory now but I don't why must make "temp" directory with them together ! I have open temp but nothing inside.

from google --> https://github.com/xerial/sqlite-jdbc/issues/97

My function run in a thread.
B4X:
Sub ExecSql(flow As String,sqls As String)
    If (sqls="") Then Return
    Dim sq As SQL' = DB.pool.GetConnection 'get a DB connection (change DB to Main)
    Try
        sq.InitializeSQLite(File.DirApp, "gsmgateway.db3", False)
        'sq.Initialize2("com.mysql.jdbc.Driver", "jdbc:mysql://" & db_host & "/data1?characterEncoding=utf8",db_account,db_passwd)  
        sq.BeginTransaction  
        sq.ExecNonQuery(sqls)
        sq.TransactionSuccessful
        Log("sql:" & flow)  
    Catch      
        If LastException.IsInitialized Then
            Log("sql:" & flow & ",Exp:"&LastException.Message)
        Else
            Log("sql:" & flow & ",Exp:Err")
        End If
    End Try
End Sub
 
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
My understanding is this:

File.DirApp returns the working directory of the command line you start the jar (not the directory of the jar)
B4X:
' jar :  /home/my/jarfolder/b4j.jar

cd /home
java -jar /home/my/jarfolder/b4j.jar  ' --> File.DirApp = /home

cd /home/my/jarfolder
java -jar b4j.jar  ' --> File.DirApp = /home/my/jarfolder
 
Last edited:
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

Oh,I always start jar from the directory of the jar ! :D
 
Upvote 0
Top