hello
I'm developing an App on Android that will connect to a database online & offline mode.
The Online Database is MSSqlServer using JdbcSQL and the local database on the device is SQLlite.
When connecting to the Online database it works perfectly, but failed to connect to localDB when offline.
The Error is : java.lang.RuntimeException: Object should first be initialized.
Below is my sample code :
Can anyone advise how to achieve this using JdbcSQL with different database connection?
I'm developing an App on Android that will connect to a database online & offline mode.
The Online Database is MSSqlServer using JdbcSQL and the local database on the device is SQLlite.
When connecting to the Online database it works perfectly, but failed to connect to localDB when offline.
The Error is : java.lang.RuntimeException: Object should first be initialized.
Below is my sample code :
B4X:
If DBOnline Then
Dim myDBRemote As JdbcSQL
myDBRemote.Initialize("net.sourceforge.jtds.jdbc.Driver", myConnectionString)
Dim myRS As JdbcResultSet =myDBRemote.ExecQuery("SELECT * FROM CUSTOMERS")
Else
Dim myfolder As String = Starter.rp.GetSafeDirDefaultExternal("")
Dim myDBlocal As JdbcSQL
myDBlocal.InitializeSQLite(myFolder, "ABSDB.db", True)
Dim myRS As JdbcResultSet = myDBlocal.ExecQuery("SELECT * FROM CUSTOMERS")
End If
Can anyone advise how to achieve this using JdbcSQL with different database connection?
Last edited: