Android Question JDBC SQL & SQLlite (Online & Offline Database)

Status
Not open for further replies.

M.SALIM

Member
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 :
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:

M.SALIM

Member
Dear Erel,
Kindly delete the POST #3.
I've inserted my full connection string to my test database by mistake .
I've already disabled access to same just in case.

Thank you in advance.
 
Upvote 0
Status
Not open for further replies.
Top