Android Question Error On java.net.SocketTimeoutException with jrdc ExecuteCommand

A Z M JANNAT UL KARIM

Member
Licensed User
Hi, I am trying to develop a simple secondary activity Feedback form where user will simply put there feedback and press sent to send the data to remote mysql database with jrdc. Problem is after sending data my activity automatically crashes with java.net.SocketTimeoutException and back to main activity. I checked my database, Data inserted successfully. Following are the code that i am using for sending data ... What did I do wrong.
B4X:
Sub cmdSend_Click
    If txtFeedback.Text = "" Then
        Msgbox("You Didn't Give Any Feedback To Submit !!!", "No Feedback")
    Else
        Dim cmd As DBCommand
        cmd.Initialize
        cmd.Name = "insert_feedback"
        If spnType.SelectedItem = "FEEDBACK" Then
            cmd.Parameters = Array As Object(txtFeedback.Text, 2, Starter.USER_ID)
        Else If spnType.SelectedItem = "COMPLAIN" Then
            cmd.Parameters = Array As Object(txtFeedback.Text, 1, Starter.USER_ID)
        End If
        Starter.reqManager.ExecuteCommand(cmd, "F")
    End If
End Sub

Sub JobDone(Job As HttpJob)
    If Job.Success = False Then
        Log("Error: " & Job.ErrorMessage)
    Else
        If Job.JobName = "DBRequest" Then
            Dim result As DBResult = Starter.reqManager.HandleJob(Job)
            Starter.sqlLiteDB.BeginTransaction
            Try
               
            Catch
                MsgboxAsync("Error Occured When Updating Data !!!" & Job.ErrorMessage, "Error")
                ' Log(LastException.Message & records(result.Columns.Get(0)))
            End Try
            Starter.sqlLiteDB.EndTransaction
        End If
    End If
    Job.Release
    Activity.Finish
End Sub
 

Star-Dust

Expert
Licensed User
Longtime User
I don't undestand this:
B4X:
 Dim result As DBResult = Starter.reqManager.HandleJob(Job)
            Starter.sqlLiteDB.BeginTransaction
            Try
            
            Catch
                MsgboxAsync("Error Occured When Updating Data !!!" & Job.ErrorMessage, "Error")
                ' Log(LastException.Message & records(result.Columns.Get(0)))
            End Try
try is empty, what Expectiont do you want to intercept?

Is it no longer correct?
B4X:
            Dim result As DBResult = Starter.reqManager.HandleJob(Job)
            Try
            Starter.sqlLiteDB.BeginTransaction
            Catch
                MsgboxAsync("Error Occured When Updating Data !!!" & Job.ErrorMessage, "Error")
                ' Log(LastException.Message & records(result.Columns.Get(0)))
            End Try
 
Upvote 0

A Z M JANNAT UL KARIM

Member
Licensed User
Hi Erel, Yes I am using v7.3. OK, I will try.
Hi Star-Dust, I am unsure about what will return from ExecuteCommand. So I left it as blank. Is it will be an Issue ?

Also I found some strange behavior. After Job finish I want to close the Activity. Sometimes when it wants it works and activity closed (it looks like). But when I close my main activity, the sub activity which previously closed shows opened in background !!! I am totally lost here what happened ... What my thought is I am doing something but can't find it :-(
 
Upvote 0

A Z M JANNAT UL KARIM

Member
Licensed User
Hi Erel, I updated the system as per process to jRDC2. Successfully querying from Main Module. Now I have a another type of issue !!! In Activity, while I press send Feedback Log shows sending message to waiting queue (ser_objecttobytes) and stopped there. No data inserted ... The codes are as follows ...

B4X:
Sub cmdSend_Click
    If txtFeedback.Text = "" Then
        Msgbox("You Didn't Give Any Feedback To Submit !!!", "No Feedback")
    Else
        Dim cmd As DBCommand
        cmd.Initialize
        cmd.Name = "insert_feedback"
        If spnType.SelectedItem = "FEEDBACK" Then
            cmd.Parameters = Array As Object(txtFeedback.Text, 2, Starter.USER_ID, Starter.DEV_LAT_STAT, Starter.DEV_LNG_STAT)
        Else If spnType.SelectedItem = "COMPLAIN" Then
            cmd.Parameters = Array As Object(txtFeedback.Text, 1, Starter.USER_ID, Starter.DEV_LAT_STAT, Starter.DEV_LNG_STAT)
        End If
        Starter.reqManager.ExecuteCommand(cmd, "F")
        Wait For(Job) JobDone(Job As HttpJob)
        If Job.Success Then
            Log("Inserted successfully!")
        End If
        Job.Release
    End If
End Sub

The insert have three types of data - Text, Integer, Double. Please help ...

Update - Don't know why but when I close the Activity manually it somehow flushes and saves data !!!
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Top