RDC - How to trap & display SQL errors

Discussion in 'Android Questions' started by Frank Cazabon, Mar 27, 2015.

  1. Frank Cazabon

    Frank Cazabon Member Licensed User


    I've been using the RDC tool with great success. My one problem is how to trap and display the error message that gets displayed on the server when there is a problem with the SQL command being run.

    Currently I have:

    Sub JobDone(Job As HttpJob)
    If Job.Success = False Then
    Log("Error: " & Job.ErrorMessage)
    Msgbox("Error: " & Job.ErrorMessage, "Unable to query Remote Database")
    But when there is an SQL problem I just get "Server Error" as Job.ErrorMessage.

    Is there another property that I can use to display the SQL error?
  2. Erel

    Erel Administrator Staff Member Licensed User

    Do you see another error message in the device logs before JobDone is fired?
  3. Frank Cazabon

    Frank Cazabon Member Licensed User

    How do I look at the device logs?
  4. alienhunter

    alienhunter Active Member Licensed User

  5. Frank Cazabon

    Frank Cazabon Member Licensed User

    Thanks, but I'm not understanding that thread fully. It looks like it is saying I can change the httputils2 library to do what you say (I guess this library is used by the RDC library?) I downloaded the httputils2 zip file, but I can't open it in B4A, it looks like there is a b4j file there. Is there a b4a version somewhere?
  6. alienhunter

    alienhunter Active Member Licensed User

    see here

    Change HttpUtils2Service
    that is how i catch those errors

    Sub Process_Globals
    Private hc As HttpClient
    Private TaskIdToJob As Map
    Public TempFolder As String
    Private taskCounter As Int
    Private Responsx As String
    End Sub

    Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
    If Response <> Null Then
    'Log("Failed to read error message.")
           Responsx="Failed to read error message."
    End Try
    End If
    False, Reason)

    Sub CompleteJob(TaskId As Int, success As Boolean, errorMessage As String)
    Dim job As HttpJob
       job = TaskIdToJob.Get(TaskId)
       job.success = success
       job.errorMessage = Responsx
    End Sub

    End Sub
  7. Frank Cazabon

    Frank Cazabon Member Licensed User

    Thanks, but I'm still not following how httputils2 is related to the RDC. Are you telling me that RDC uses httputils2 to communicate and that I should replace my existing httputils with a new one?
    alienhunter likes this.
  8. alienhunter

    alienhunter Active Member Licensed User

    ohhh sh... i forgot this sorry
    yes you have to use this , make sure you do not have the HttpUtils2 library checked in case you used this before


    you know you have to import the 2 files from the link and change them right ?
    add existing modules
    Last edited: Mar 27, 2015
  9. rad

    rad Member Licensed User

    Hi alienhuter...

    I have the same issue Frank...
    I have implement RDC in my project successfully... but the issue is, all error from mysql (like unique constraint, duplicate entry), in my application only displaying "Server Error". Not displaying error message from MySQL specifically.

    Please help me to solve this issue...

    This What i have...

    Sub JobDone(Job As HttpJob)
    If Job.Success = False Then
    Log("Error: " & Job.ErrorMessage)
    Msgbox (Job.ErrorMessage, "Job Error")
    If Job.JobName = "DBRequest" Then
    Dim result As DBResult = reqManager.HandleJob(Job)
    Select result.Tag
    Case "LoadData"
    'Tampilkan data ke dalam bentuk Table.
                        tblData.LoadRDCResult(result, True)
    'Set alignment for each cell
                        Dim alignments() As Int
                        alignments = 
    Array As Int (Bit.Or(Gravity.CENTER, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL), Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL),  Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL),  Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL),  Bit.Or(Gravity.CENTER, Gravity.CENTER_VERTICAL),  Bit.Or(Gravity.CENTER, Gravity.CENTER_VERTICAL),  Bit.Or(Gravity.CENTER, Gravity.CENTER_VERTICAL))
    If result.Rows.Size = 0 Then
    ToastMessageShow("Data is empty..."True)
    ToastMessageShow("Long Touch selected row to see detail advertising..."True)
    End If
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice