Android Question How do we create Database thru SQLite?

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Erel,

I am downloading datatable from my online ms sql databse thru jason. It is taking around 1 min 25secs everytime.
I want to download this datatable in SQLite table once and use it from there so that it is faster from second time.Is there any example of this functionality.

Thanks in advance.
 

imbault

Well-Known Member
Licensed User
Longtime User
Hi,
You want to download your data from MS SQL, via a Web Service?
What do you mean by downloading once ? Is that online or you just want export your MS SQL data ?
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi ,
Yes via web service.
There is some data in MS SQL which will not change for some time.This data i want to download once in SQLite and keep using it.
Here requirement is simple.

Thanks
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
Ok, so this is quite easy:
You have to call your web service method from your app, then you receive a Json string with all your data, so first create the SQLite Database that matches your database structure.
Then in your JobDone sub , if successful, you do something like this code:
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Many Thanks Imbault,
The code its showing errors for DBUtils( guess its a lib searching to download)
Pls inform Sqlpi is what type of variable in main.

Juzer
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
Many Thanks Imbault,
The code its showing errors for DBUtils( guess its a lib searching to download)
Pls inform Sqlpi is what type of variable in main.

Juzer

Ok SQLpi is a SQL object declared in Main:
B4X:
Sub Process_Globals
    Dim ProgDB  = "sms.db" As String
    Dim sqlpi As SQL
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If File.Exists(File.DirDefaultExternal, ProgDB)=False Then
        CreateDB
    End If
   
    sqlpi.Initialize(File.DirDefaultExternal, ProgDB, False)
....
Concerning DbUtils, you can find it on this forum https://www.b4x.com/android/forum/threads/dbutils-android-databases-are-now-simple.8475/
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
What error do you have?
you just need SQL Library and DbUtils Code Module...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…