B4J Question Error connect B4J via 2nd jRDC on Linux

Sifu

Active Member
Hello,

I have 1 jRDC.jar running on linux as server. Work ok with B4A test app.
I did not understand the description for using 1 server for 2 database. I looked for similar other questions in forum.
Then I use same jRDC for 2nd DB but changed this line in Main sub appstart to:
B4X:
srvr.AddHandler("/das", "RDCHandler", False)
Is it allowed to change /rdc for /das ?

I changed config file port nr 17178 to 17179, db name is different, password is same.
B4X:
#Java server port
ServerPort=17179

filename is now jRDCdas.jar uploaded to Linux server, same place as other jRDC.jar

Both servers are running, I checked with: ps -ef | grep java

This 2nd DB I want to use with B4J testapp. I changed the String
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
    Type DBCommand (Name As String, Parameters() As Object)
    Dim const rdcLink As String = "http://192.168.0.240:17179/das"
End Sub

Rest of code is same as in B4A. But in B4J I choose jOkHttpUtils2 and jRandomAccessFile library.

I get error:
B4X:
ResponseError. Reason: java.net.ConnectException: Failed to connect to /192.168.0.240:17179, Response: 
ERROR: java.net.ConnectException: Failed to connect to /192.168.0.240:17179

Any idea what I have missed?

Thank you.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

josejad

Expert
Licensed User
Longtime User
I did not understand the description for using 1 server for 2 database.

It's quite easy. You just have to write your db name before the table:
B4X:
Select * from dbname.MyTable

instead of

B4X:
Select * from MyTable

Remember the user you're using in the config.properties to access your databases, has to have permissions to access both databases.

More info in this post
 
Upvote 0

Sifu

Active Member
Thank you both. I was out for work a few days.
I will try it today and come back with my results.
What Jose mentiones, I did also try but I did not get the results from the correct db
I'm sending an row id from which I need the information so I use the Select * from table where id = ?
 
Upvote 0

Sifu

Active Member
@ Jose
Yes indeed I did as you write "Select * from DB_NAME.table where id = ?" when I was using 1 jRDC server. It did not work.

Now I have 2 running each with own configuration file and sql commands.
1st is still running ok, 2nd runs ok according the JAVA process. I have opened the test url as Erel said.

192.168.0.240:17178/test give good result
192.168.0.240:17179/test give not good result. Erel was right, for this I forgot to open the port. After this the test URL work ok. Thanks for the heads-up.

Sorry for waisting your time.
Now I can work further and try to solve another issue.

Thank you for your help.
 
Upvote 0
Top