Android Question [SOLVED] jRDC2 Error : unexpected url: ?method=batch2

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

I have a stored procedure like this on Firebird database server
B4X:
CREATE PROCEDURE INS_CMPNY (
    CMPNY Varchar(180),
    DT Date,
    CD char(36))
AS
BEGIN
END

I have tested on the server, the procedure runs OK.
But when executed on B4A with this code
B4X:
Sub Test  
   wait for(ExecCommand("ins_cmpny",Array As Object("Cmpny","2020-01-01","C7D646DA-1EEE-4577-9522-A24080A528DE"),"Please wait, ...")) complete (DbRsl As List)
End Sub

Sub ExecCommand(Name As String, Parameters() As Object,Msg As String) As ResumableSub
    Private req As DBRequestManager = CreateRequest
    Private cmd As DBCommand         = CreateCommand(Name,Parameters)
    Private result As DBResult
    Private ErrMsg As String
   
    If Msg <> "" Then ProgressDialogShow2(Msg,False)
    wait for (req.ExecuteCommand(cmd, cmd.Name)) JobDone (job As HttpJob)
    ProgressDialogHide
   
    If job.success Then
        result = req.HandleJob(job)
        ErrMsg = ""
    Else
        result = Null
        ErrMsg = job.ErrorMessage
    End If

    job.Release
   
    Private L As List
    L.Initialize
    L.Add(result)
    L.Add(GetErrMsg(ErrMsg))
    Return L
End Sub

Got the error :
java.lang.IllegalArgumentException: unexpected url: ?method=batch2
at okhttp3.Request$Builder.url(Request.java:142)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializePost2(OkHttpClientWrapper.java:429)

Any hints how to fix this error?
 

DonManfred

Expert
Licensed User
Longtime User
I dont see you using batch2 anywhere in the code you posted

What is the content of your CreateRequest sub?


The error and the code you posted are not related it seems.
 
Last edited:
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
Found the error.

Problem is in CreateRequest Sub
B4X:
Private Sub CreateRequest As DBRequestManager
    Dim req As DBRequestManager
    req.Initialize( Me, Svr)
    Return req
End Sub

The error caused by variable Svr in CreateRequest Sub is empty. After corrected, now runs OK.
 
Upvote 0
Top