Oct 13, 2015 Replies: 37 jRDC version 2 is available here: https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/ Please start with this thread if you are not familiar with RDC: Remote Database Connector (RDC) - Connect to any remote DB RDC was implemented before B4J was available. It was implemented in Java. jRDC is a port of RDC server to B4J. The main advantage of jRDC over RDC is that you can modify the source code. For example you can easily add support for SSL or connect to multiple databases. The performance of both servers is the same. Note that B4J creates executable jars so you can start the server with a double click or from the command line with: Code: java -jar jRDC.jar There are some differences between the behavior and configuration of jRDC and RDC: On the client, the server link should end with /rdc. For example: Code: reqManager.Initialize(Me, "http://192.168.0.6:17178/rdc") You need to set the jdbc jar with the #AdditionalJar attribute (on the server). There is no jdbc_driver folder. jRDC always returns 0 for the affected rows fields in batch requests. From the client side you just need to add /rdc to the link and it should work. There is another difference related to the way nulls are handled. It shouldn't be a problem with new jdbc drivers. jRDC v1.00 is attached. It fixes an issue related to blobs. Attachments jRDC.zip jRDC.zip 4.8 KB · Views: 1,729 Last edited: Dec 29, 2015 Click to expand...
jRDC version 2 is available here: https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/ Please start with this thread if you are not familiar with RDC: Remote Database Connector (RDC) - Connect to any remote DB RDC was implemented before B4J was available. It was implemented in Java. jRDC is a port of RDC server to B4J. The main advantage of jRDC over RDC is that you can modify the source code. For example you can easily add support for SSL or connect to multiple databases. The performance of both servers is the same. Note that B4J creates executable jars so you can start the server with a double click or from the command line with: Code: java -jar jRDC.jar There are some differences between the behavior and configuration of jRDC and RDC: On the client, the server link should end with /rdc. For example: Code: reqManager.Initialize(Me, "http://192.168.0.6:17178/rdc") You need to set the jdbc jar with the #AdditionalJar attribute (on the server). There is no jdbc_driver folder. jRDC always returns 0 for the affected rows fields in batch requests. From the client side you just need to add /rdc to the link and it should work. There is another difference related to the way nulls are handled. It shouldn't be a problem with new jdbc drivers. jRDC v1.00 is attached. It fixes an issue related to blobs.
marcick Well-Known Member Licensed User Longtime User Oct 20, 2015 #3 Hi. I was thinking to replace the actual RDC with this one. The goal is to add in each RDC command a custom text parameter that the server shows in the console. This would help me to identify the customers just watching the console. First question is .. I can't see the console ... which is the best way to implement it ? Second difficulties is how to manage the custom text, but I think I should look the SUb "LoadSQLCommands" and understant it.
Hi. I was thinking to replace the actual RDC with this one. The goal is to add in each RDC command a custom text parameter that the server shows in the console. This would help me to identify the customers just watching the console. First question is .. I can't see the console ... which is the best way to implement it ? Second difficulties is how to manage the custom text, but I think I should look the SUb "LoadSQLCommands" and understant it.
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2015 #4 marcick said: First question is .. I can't see the console ... which is the best way to implement it ? Click to expand... You will see the logs when: 1. Run it from the IDE. 2. Run it from the command line with: java -jar <your jar>
marcick said: First question is .. I can't see the console ... which is the best way to implement it ? Click to expand... You will see the logs when: 1. Run it from the IDE. 2. Run it from the command line with: java -jar <your jar>
marcick Well-Known Member Licensed User Longtime User Oct 21, 2015 #5 oh, understood, so anything is added as log in B4J then is showed in the console. Very good, thanks Marco
oh, understood, so anything is added as log in B4J then is showed in the console. Very good, thanks Marco
marcick Well-Known Member Licensed User Longtime User Oct 21, 2015 #6 Some troubles ... this is the code B4A side Code: reqManager1.Initialize(Me, "http://100.100.100.100:17178/rdc") Dim cmd As DBCommand cmd.Initialize cmd.Name = "RDC_Test" cmd.Parameters = Array As Object(Null) reqManager1.ExecuteQuery(cmd, 0, "tag1") in config.properties I have Code: sql.RDC_Test = SELECT COUNT(*) FROM `records` But I get this error: Code: (SQLException) java.sql.SQLException: Parameter index out of range (1 > number o f parameters, which is 0). Command: , tool: 0ms, client=82.60.232.57 Where I'm wrong ? The same identical code (except for the "/rdc" suffix in reqmanager.initialize) is working on the "old" RDC
Some troubles ... this is the code B4A side Code: reqManager1.Initialize(Me, "http://100.100.100.100:17178/rdc") Dim cmd As DBCommand cmd.Initialize cmd.Name = "RDC_Test" cmd.Parameters = Array As Object(Null) reqManager1.ExecuteQuery(cmd, 0, "tag1") in config.properties I have Code: sql.RDC_Test = SELECT COUNT(*) FROM `records` But I get this error: Code: (SQLException) java.sql.SQLException: Parameter index out of range (1 > number o f parameters, which is 0). Command: , tool: 0ms, client=82.60.232.57 Where I'm wrong ? The same identical code (except for the "/rdc" suffix in reqmanager.initialize) is working on the "old" RDC
Erel B4X founder Staff member Licensed User Longtime User Oct 21, 2015 #7 You are sending a single parameter (with the value of null) and the command doesn't expect any parameter. Remove the line that sets cmd.Parameters or change it to: Code: cmd.Parameters = Array As Object()
You are sending a single parameter (with the value of null) and the command doesn't expect any parameter. Remove the line that sets cmd.Parameters or change it to: Code: cmd.Parameters = Array As Object()
marcick Well-Known Member Licensed User Longtime User Oct 22, 2015 #8 Perfect ! Now, when I'm at this line in SUB Handle of RDCHandler module: Code: Log($"Command: ${q}, tool: ${DateTime.Now - start}ms, client=${req.RemoteAddress}"$) How to retrieve all the parameters of the request ?
Perfect ! Now, when I'm at this line in SUB Handle of RDCHandler module: Code: Log($"Command: ${q}, tool: ${DateTime.Now - start}ms, client=${req.RemoteAddress}"$) How to retrieve all the parameters of the request ?
Erel B4X founder Staff member Licensed User Longtime User Oct 22, 2015 #9 Go over the code you will see where the parameters are extracted.
marcick Well-Known Member Licensed User Longtime User Oct 22, 2015 #11 Me again .. running the jar from the command line I see a log file is created that contains strings like: Code: 82.60.232.57 - - [22/Oct/2015:11:40:38 +0000] "POST /rdc?method=query HTTP/1.1" 200 - "-" "-" Is it possible to avoid this log or eventually customize it ?
Me again .. running the jar from the command line I see a log file is created that contains strings like: Code: 82.60.232.57 - - [22/Oct/2015:11:40:38 +0000] "POST /rdc?method=query HTTP/1.1" 200 - "-" "-" Is it possible to avoid this log or eventually customize it ?
Erel B4X founder Staff member Licensed User Longtime User Oct 22, 2015 #12 Please start a new thread for this and I'll explain what can be done (it is not specific to jRDC).
Erel B4X founder Staff member Licensed User Longtime User Oct 29, 2015 #13 v1.00 is attached to the first post. It fixes an issue related to blobs.
incendio Well-Known Member Licensed User Longtime User Nov 2, 2015 #14 How to connect to multiple database and add support for SSL?
Erel B4X founder Staff member Licensed User Longtime User Nov 2, 2015 #15 See this thread about B4J servers and SSL: https://www.b4x.com/android/forum/threads/server-ssl-connections.40130/#content Please start a new thread for the multiple databases question.
See this thread about B4J servers and SSL: https://www.b4x.com/android/forum/threads/server-ssl-connections.40130/#content Please start a new thread for the multiple databases question.
incendio Well-Known Member Licensed User Longtime User Nov 2, 2015 #16 OK, thanks for your info. New thread created, https://www.b4x.com/android/forum/threads/jrdc-how-to-connect-to-multiple-database.59930/
OK, thanks for your info. New thread created, https://www.b4x.com/android/forum/threads/jrdc-how-to-connect-to-multiple-database.59930/
A Anser Well-Known Member Licensed User Longtime User Nov 3, 2015 #17 Erel said: There is another difference related to the way nulls are handled. It shouldn't be a problem with new jdbc drivers. Click to expand... Will this break my existing B4A code? In my code, I have many lines that check for Null For eg. Code: If records(result.Columns.Get("Activity_DateTime")) = Null Then If records(result.Columns.Get("Bill_Amt")) = Null Then So do I have to take care of all that ? Erel said: From the client side you just need to add /rdc to the link and it should work. Click to expand... If the change in my B4A code is minimal then, I am planning to move from RDC to jRDC Regards Anser
Erel said: There is another difference related to the way nulls are handled. It shouldn't be a problem with new jdbc drivers. Click to expand... Will this break my existing B4A code? In my code, I have many lines that check for Null For eg. Code: If records(result.Columns.Get("Activity_DateTime")) = Null Then If records(result.Columns.Get("Bill_Amt")) = Null Then So do I have to take care of all that ? Erel said: From the client side you just need to add /rdc to the link and it should work. Click to expand... If the change in my B4A code is minimal then, I am planning to move from RDC to jRDC Regards Anser
Erel B4X founder Staff member Licensed User Longtime User Nov 3, 2015 #18 Anser said: Will this break my existing B4A code? Click to expand... It will most probably work exactly as before. The change is not related to Null checking. It is related to the way Null parameters are bound to the query. It is only relevant to older jdbc drivers.
Anser said: Will this break my existing B4A code? Click to expand... It will most probably work exactly as before. The change is not related to Null checking. It is related to the way Null parameters are bound to the query. It is only relevant to older jdbc drivers.
incendio Well-Known Member Licensed User Longtime User Nov 3, 2015 #19 Better to move to jRDC. I have seen its features & 1 is really obvious, security. With RDC, user name & password,url, sql commands, etc, stored on config file with is very easy to read. With jRDC, you can embedded in jar file or on any encrypted file.
Better to move to jRDC. I have seen its features & 1 is really obvious, security. With RDC, user name & password,url, sql commands, etc, stored on config file with is very easy to read. With jRDC, you can embedded in jar file or on any encrypted file.
Erel B4X founder Staff member Licensed User Longtime User Nov 3, 2015 #20 incendio said: With RDC, user name & password,url, sql commands, etc, stored on config file with is very easy to read. Click to expand... If someone has access to the server files then nothing on the server is secure. I agree that it is better to move to jRDC.
incendio said: With RDC, user name & password,url, sql commands, etc, stored on config file with is very easy to read. Click to expand... If someone has access to the server files then nothing on the server is secure. I agree that it is better to move to jRDC.