S Sifu Active Member Oct 12, 2021 #1 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: Code: 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.
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: Code: 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 Oct 13, 2021 #2 Sifu said: Is it allowed to change /rdc for /das ? Click to expand... Of course, though it is not needed as you are using a different port. First step is to call the test url from the same computer: https://www.b4x.com/android/forum/t...-rdc-remote-database-connector.61801/#content Assuming that it works locally and doesn't work remotely then it is likely to be a firewall issue. Upvote 0
Sifu said: Is it allowed to change /rdc for /das ? Click to expand... Of course, though it is not needed as you are using a different port. First step is to call the test url from the same computer: https://www.b4x.com/android/forum/t...-rdc-remote-database-connector.61801/#content Assuming that it works locally and doesn't work remotely then it is likely to be a firewall issue.
josejad Expert Licensed User Longtime User Oct 13, 2021 #3 Sifu said: I did not understand the description for using 1 server for 2 database. Click to expand... It's quite easy. You just have to write your db name before the table: Code: Select * from dbname.MyTable instead of Code: 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 jRDC2: Can the same instance of the Jserver connect to 2 seperate DataBases? Hi jRDC gurus! Can the same instance (I one single jRDC server) connect to 2 (or more) databases? If so, can a sample code/ config be provided? Or do I really need to run 1 server per database? www.b4x.com Upvote 0
Sifu said: I did not understand the description for using 1 server for 2 database. Click to expand... It's quite easy. You just have to write your db name before the table: Code: Select * from dbname.MyTable instead of Code: 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 jRDC2: Can the same instance of the Jserver connect to 2 seperate DataBases? Hi jRDC gurus! Can the same instance (I one single jRDC server) connect to 2 (or more) databases? If so, can a sample code/ config be provided? Or do I really need to run 1 server per database? www.b4x.com
S Sifu Active Member Oct 15, 2021 #4 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
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 = ?
josejad Expert Licensed User Longtime User Oct 15, 2021 #5 Sifu said: so I use the Select * from table where id = ? Click to expand... But you should use "Select * from DB_NAME.table where id = ?" Upvote 0
Sifu said: so I use the Select * from table where id = ? Click to expand... But you should use "Select * from DB_NAME.table where id = ?"
S Sifu Active Member Oct 15, 2021 #6 @ 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
@ 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.