B4J Library [B4X] jRDC2 - B4J implementation of RDC (Remote Database Connector)

Status
Not open for further replies.

Cableguy

Expert
Licensed User
Longtime User
Insert is already correct. But a finished or true, return as soon, as the data has been written to the database.
The job done sub is the place where you will be given that info...
An insert command will not return a recorset
 

asawyer13

Member
Licensed User
Longtime User
I am pretty new to B4A and see a lot of posts on updating/inserting/deleting data from mysql which is what I want to use. I have a unique situation in that I want to be able to do this using B4A and possibly B4I eventually, but also using another product that is running javascript locally so it needs a secure way to update/insert/delete data on the server which is running Windows and mysql. Is there documentation or something that would tell my how I could communicate with jRDC2 when I'm not using a B4X product, but the other one?
 

Haris Hafeez

Active Member
Licensed User
Longtime User
You cannot use jRDC with non B4X code. If you have a mix of applications, with some developed with B4A/B4i and some other application (such as a PHP web application), you need to expose your business operations as RESTful services from your server and then consume those services from all of your applications.
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User

This is partially true. Indeed you cannot use the same JRDC code with non b4x apps. Yet it is superfluous to make it receive Json instructions and pass them to the "jrdc logic" and again send that info in Json too.

It is a matter of adding another handler to do this. And you can keep your b4x apps intact.
 

Haris Hafeez

Active Member
Licensed User
Longtime User
It is completely true. You cannot just use jrdc with other applications written in non b4x tools without working out the byte level protocol, which is pointless.
And yes, there's no point in using jrdc if you're writing a Restful server in b4j. My point was that your business operations server should be tool agnostic and expose rest operations so those operations can be consumed by Windows apps, b4x apps, php apps etc. It does not have to be B4J to implement such a server though it is a perfectly good choice.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

A Z M JANNAT UL KARIM

Member
Licensed User
Hi, I am running 3 ExecuteQuery sequentially with Tag to retrieve data from Database like follows ...
reqManager.ExecuteQuery(cmd, 0, "D")
reqManager.ExecuteQuery(cmd, 0, "G")
reqManager.ExecuteQuery(cmd, 0, "R")

Based on the tag it will retrieve data from three tables and insert data to the SQLLite DB for Offline Access. After that I populate the ListView from the SQLLite DB.
Now I want to know when the job process completed? I think I need to use CallSubDelayed but the problem is where should I use it to get the final job done response to Fill the ListBox. Please check the last line to FillList call event after Job.Release. It call three times whereas I want to call it once.

My codes are as follows ...
B4X:
Sub GetPartyInfo(PartyType As String)
    Dim cmd As DBCommand
    cmd.Initialize
    If PartyType = "D" Then
        cmd.Name = "select_dealer"
        cmd.Parameters = Array As Object(manager.GetString("mobPhone"))
        reqManager.ExecuteQuery(cmd, 0, "D")
    Else If PartyType = "G" Then
        cmd.Name = "select_golden"
        cmd.Parameters = Array As Object(manager.GetString("mobPhone"))
        reqManager.ExecuteQuery(cmd, 0, "G")
    Else If PartyType = "R" Then
        cmd.Name = "select_retailer"
        cmd.Parameters = Array As Object(manager.GetString("mobPhone"))
        reqManager.ExecuteQuery(cmd, 0, "R")
    End If
    CallSubDelayed(Me, "GetPartyInfo_Complete")
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 = reqManager.HandleJob(Job)
            Starter.sqlLiteDB.BeginTransaction
            Try
                For Each records() As Object In result.Rows
    ' Do Some Database Stuff Here
                Next
                Starter.sqlLiteDB.TransactionSuccessful
            Catch
                Msgbox("Error Occured When Updating Data !!!", "Error")
            End Try
            Starter.sqlLiteDB.EndTransaction
        End If
    End If
    Job.Release
    FILL_LIST
End Sub
 

achtrade

Active Member
Licensed User
Longtime User
I have RDC running in my server successfully. Now I would like to change it for this jRDC2 but I can not find a tutorial to setup a linux server with this new jRDC2.

can someone please post the necessary steps to achieve this ?

thanks
 

DonManfred

Expert
Licensed User
Longtime User

Sapta

Member
Licensed User
Longtime User
I have error, like this. How to solve?
thank you

B4A Version: 7.30
Parsing code. Error
Error parsing program.
Error description: Undeclared variable 'rdclink' is used before it was assigned any value.
Error occurred on line: 68 (Main)
req.Initialize(Me, rdcLink)

From this code :
B4X:
Sub CreateRequest As DBRequestManager
   Dim req As DBRequestManager
   req.Initialize(Me, rdcLink)
   Return req
End Sub
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…