Android Question SQL + DBUtils - Connection Closed?

joilts

Member
Licensed User
Longtime User
I'm using DBUtils to access my SQL Lite DB. It works fines in many tests. But looking at Google Developer Console for errors, I found many error associated to :
B4X:
java.lang.RuntimeException: Object should first be initialized.
    at anywheresoftware.b4a.sql.SQL.checkNull(SQL.java:48)
    at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:166)

Just opened my Database using : SQL_CONN.Initialize(global.dbDir, Database_Name, True)
And passes SQL_CONN to all DBUtils Methods.
It there any situation that my Connection gets closed?
It would be a valid solution to use Conn.IsInitialized before any query? And if it returns False, then open database again?
 
Last edited:

joilts

Member
Licensed User
Longtime User
No.

Are you initializing the SQL object in Service_Create of the Starter service?

No. Was initializing on Main Activity. I'm going to change to Starter Service to test. Thanks, for reply.
 
Last edited:
Upvote 0
Top