J joilts Member Licensed User Longtime User Jul 13, 2016 #1 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 : Code: 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: Jul 13, 2016
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 : Code: 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?
Erel B4X founder Staff member Licensed User Longtime User Jul 13, 2016 #2 joilts said: It there any situation that my Connection gets closed? Click to expand... No. Are you initializing the SQL object in Service_Create of the Starter service? Upvote 0
joilts said: It there any situation that my Connection gets closed? Click to expand... No. Are you initializing the SQL object in Service_Create of the Starter service?
J joilts Member Licensed User Longtime User Jul 13, 2016 #3 Erel said: No. Are you initializing the SQL object in Service_Create of the Starter service? Click to expand... No. Was initializing on Main Activity. I'm going to change to Starter Service to test. Thanks, for reply. Last edited: Jul 13, 2016 Upvote 0
Erel said: No. Are you initializing the SQL object in Service_Create of the Starter service? Click to expand... No. Was initializing on Main Activity. I'm going to change to Starter Service to test. Thanks, for reply.