Best practice with B4A to sync MSSQL tables with Android Sqlite

infow

Member
Licensed User
Longtime User
Hi,

I just purchased Basic4Android.

I need some advice or example of the best way with B4A transfer tables from a MSSQL server to a database inside the celular, and vice-versa.
Resuming: I will need sync some tables.

Any advice, best practice or sample to put me on the track will be appreciated, a few tables will be large. 30000 lines
My goal it’s a sales force app.

Many Thanks in Advance

Infow
 

infow

Member
Licensed User
Longtime User
Hi Erel,

Thanks, I go for it... and testing now...
Im got error if I try to transfer big tables, few data comes ok:

httputils_getstring (B4A line: 93)
Return File.GetText(HttpUtilsService.TempFolder, SuccessfulUrls.Get(URL))
java.lang.OutOfMemoryError


at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:114)
at java.lang.StringBuilder.append(StringBuilder.java:249)
at anywheresoftware.b4a.objects.streams.File$TextReaderWrapper.ReadAll(File.java:568)
at anywheresoftware.b4a.objects.streams.File.GetText(File.java:209)
at ifw.infowarefvm.httputils._getstring(httputils.java:173)
at ifw.infowarefvm.main._jobdone(main.java:378)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:797)
at anywheresoftware.b4a.keywords.Common.CallSub2(Common.java:782)
at ifw.infowarefvm.httputilsservice._processnexttask(httputilsservice.java:249)
at ifw.infowarefvm.httputilsservice._response_streamfinish(httputilsservice.java:350)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at anywheresoftware.b4a.BA$3.run(BA.java:303)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0

infow

Member
Licensed User
Longtime User
Probably thats it.

Im using the HTTPUtils to make it easy... Probably for such large tables, may I will need to page the records requests for the data... using OFFSET like comands in the query....

What you suggest?

Many Thanks Erel, and congratulations for the nice job you done!
 
Upvote 0

infow

Member
Licensed User
Longtime User
Thanks!

Another newb question:

Im using HttpUtils, I tried to get tables with this commands:

HttpUtils.PostString("Job1", ServerUrl, "SELECT * FROM TAB1")
HttpUtils.PostString("Job2", ServerUrl, "SELECT * FROM TAB2")

Expecting that after the JobDone the code resumes from the sub that started the 1st PostString, but its not happening, the second PostString does not fire...

I see a sample that work only calling a poststring from a JobDone, other samples not, with dim, Initialize and such that seems working the way I expected...

Any advise will be great, in the best way to load consecutive tables...

Many Thanks in Advance.
 
Upvote 0

infow

Member
Licensed User
Longtime User
I just found the problem:

Commas "," in as a content of a MSSQL field like a address (returned in a response):

"SAO PAULO STREET, 1233"

can cause a error in the listofvalues of DBUTILS?

SQL.ExecNonQuery2(sb.ToString, listOfValues)

In this case, how can I best deal with it?

Thanks.
 
Upvote 0

infow

Member
Licensed User
Longtime User
Just tested without commas...

It seems there is no effect on DBUtils...

I will investigate more.
 
Upvote 0
Top