Android Question How do we create Database thru SQLite?

Discussion in 'Android Questions' started by Juzer Hussain, Jul 4, 2015.

  1. Juzer Hussain

    Juzer Hussain Active Member Licensed 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.
     
  2. imbault

    imbault Well-Known Member Licensed 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 ?
     
  3. Juzer Hussain

    Juzer Hussain Active Member Licensed 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
     
  4. imbault

    imbault Well-Known Member Licensed 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:
     
  5. Juzer Hussain

    Juzer Hussain Active Member Licensed 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
     
  6. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi Imbault,
    OK Sqlpi is from DBUtils module. Pls help me with tools object where to find this.
    Thanks
    Juzer
     
  7. imbault

    imbault Well-Known Member Licensed User

    Ok SQLpi is a SQL object declared in Main:
    Code:
    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 http://www.b4x.com/android/forum/threads/dbutils-android-databases-are-now-simple.8475/
     
  8. DonManfred

    DonManfred Expert Licensed User

    Have you tried to use the forumsearch? No. Try it.
     
    LucaMs and lemonisdead like this.
  9. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi Imbault,

    Pls tell me which library to add to get tools class.it gives error there.

    Thanks
    Juzer
     
  10. imbault

    imbault Well-Known Member Licensed User

    What error do you have?
    you just need SQL Library and DbUtils Code Module...
     
Loading...