Android Question [SOLVED] Android client - JRDC2 server and BLOB

makis_best

Well-Known Member
Licensed User
Longtime User
Hi everyone.

I try to retrieve some blob images from my server side using JRDC2. Not many just 18000... ?
The problem is that every time I try I get time out error.. if i filter my records for example top 100 then everything working fine.
Any idea how I can skip this time out error?

The code I use in B4A is

B4X:
Sub ESFIItemBlob_ReplaseInto(Dt1 As String, FStart As Boolean) As ResumableSub
    Dim AllDone As Boolean
    Dim i As Int = 1
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("Select_ESitemBlob_ReplaseInto", Array(Dt1, Dt1))
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        'work with result
        'req.PrintTable(res)
        For Each row() As Object In res.Rows
            Dim b() As Byte = row(res.Columns.Get("TS"))
            Dim bc As ByteConverter
'            Log(bc.HexFromBytes(b))
            Starter.LocalSQL.ExecNonQuery2($"REPLACE INTO LOCAL_Blob (Item_Code, IItem_GID, BlobData, BlobSize, TS)
            VALUES (?, ?, ?, ?, ?)"$, Array As Object(row(1), row(2), row(3), row(4), bc.HexFromBytes(b)))
        Next
        AllDone = True
    Else
        Log("ERROR: " & j.ErrorMessage)
        AllDone = False
    End If
    j.Release
    Return AllDone
End Sub

The error I get is
ResponseError. Reason: java.net.SocketTimeoutException, Response:
ERROR: java.net.SocketTimeoutException

Any help how to solve it?
 

makis_best

Well-Known Member
Licensed User
Longtime User
I tried your solution @Erel, but now after awhile I get the error
======== ESFILineItem Complete ===========

======== ESMMItemMU ===========
Date: 2020-07-01
Date: 01/07/2020
Changes: 0
Completed. Success: true
======== ESMMItemMU Complete ===========

======== ESFIItemBlob ===========
Date: 2020-07-01
Date: 01/07/2020
java.lang.OutOfMemoryError: Failed to allocate a 67092492 byte allocation with 16777216 free bytes and 50MB until OOM
at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:201)
at anywheresoftware.b4a.objects.streams.File.Copy2(File.java:362)
at anywheresoftware.b4a.keywords.Bit.InputStreamToBytes(Bit.java:94)
at gr.iosif.droidview.dbrequestmanager$ResumableSub_HandleJobAsync.resume(dbrequestmanager.java:130)
at gr.iosif.droidview.dbrequestmanager._handlejobasync(dbrequestmanager.java:93)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5376)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

What it means?
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Yes, by using ranges in your sql statement and doing it in batches (Maybe 100 at a time)?
 
Upvote 0
Top