B4J Question jRDC, How to connect to multiple database?

Discussion in 'B4J Questions' started by incendio, Nov 2, 2015.

  1. incendio

    incendio Well-Known Member Licensed User

    Hi guys,

    I need a help, how to configure jRDC to connect to multiple database.

    Thanks in advance.
  2. Erel

    Erel Administrator Staff Member Licensed User

    You will need to understand how the code is built and change it a bit. It is quite simple.

    Replace rdcConnector1 with rdcConnectorA and rdcConnectorB.
    Each one of them will point to a different database (you will need to take care of loading the correct configuration file).

    Now in RDCHandler add this to Class_Globals
    private connector as RDCConnector
    private connectors As Map = CreateMap("a": Main.rdcConnectorA, "b": Main.rdcConnectorB)
    You will need to add an additional parameter to the query (together with the method parameter). Lets call it database.
    Dim method As String = req.GetParameter("method")
    connector = connectors.Get(req.GetParameter(
    The last step is to change the references to Main.rdcConnector1 with connector.
    Ed Brown and incendio like this.
  3. Rudi Purwanto

    Rudi Purwanto Member

    i follow this instruction but, how about configuration file ? should i create 2 config file ? if yes, how i call these config file ?
    also about main, should i create srvr1 and srvr2 to define server port ?
    and about testhandler should i create connector again like in testhandler ?

    thx alot
    Last edited: Aug 10, 2016
  4. Erel

    Erel Administrator Staff Member Licensed User

    Yes, you need to create two configuration files. Modify RDCConnector and add a field that allows you to set the configuration file that will be used.
  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