Android Question moving from jRDC to jRDC2

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
Hi, I was reading several days the forum and I didn't find the way to moving from jRDC to jRDC2 at the server side.

I have an SQL Server with B4A Remote Database Connecter (version 0.9) working perfectly with B4A application using DBRequestManager class.
I am updating DBRequestManager to last version, and now I am not able to moving the jRDC to jRDC2 at the server side.

At the client side, I download the last SQL jDBC and unpack it, after I added the code

#AdditionalJar: mssql-jdbc-6.4.0.jre9.jar

and at compile time get the error:

ERROR: java.util.zip.ZipException: Not in GZIP format

Are there any guide to update jRDC in SQL Server to use it from B4A app?


Thanks
 

OliverA

Expert
Licensed User
Longtime User
If you are using DBRequestManager on the client, then why are you also loading the MSSQL JDBC driver on the client? I thought the old DBRequestManager works with the new jRDC2 server (at least by looking at the code of jRDC2). Now if you updated your DBRequestManager class, you may need to change your code that uses it. For usage examples of the new DBRequestManger, see the jRDC2 page. https://www.b4x.com/android/forum/t...-rdc-remote-database-connector.61801/#content
 
Upvote 0

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
Thanks Oliver,
the problem is just it, I don't know how to install or update from jRDC to jRDC2 at the server side, in the SQL Server machine.
May be I don't need the MSSQL jdbc driver with new DBRequestManger, but I was reading several times and watching video in that page and it not explain how to install jRDC2 or use with SQL Server.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
jRDC was .NET? jRDC2 is a Java application. You compile it with B4J in release mode. You can then copy the generated .jar file on the server. Since it is a Java application, you have to install Java on the server. You will need the MS SQL java JDBC driver, but it needs to be installed on the same machine that will run the jRDC2 server. You need to match up the driver with the Java version that you install on the server. Configuration of the driver parameters are done in the config.properties file that is located in the Files directory of the jRDC2's source folder. As set up, you have to set all all parameters in config.properties before compiling the jRDC2 server.
 
Upvote 0

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
I was trying a long time to understand how works jRDC2.
I was working perfectly the older jRDC as a framework at the server side.
Watching the Erel's video guide several times and reading many other info I was able to get an connection successful with a http://localhost:17178/test

Steps done to reach this:
- Install B4J (I never used it)
- Download jRDC2 from https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/ , unzipping it and opening jRDC.b4j project with B4J software.
- Download jdbc driver for SQL and copying mssql-jdbc-6.4.0.jre8.jar file to "c:\Program Files (x86)\Anywhere Software\B4J\Libraries\mssql-jdbc-6.4.0.jre8.jar"
- Replace #AdditionalJar: in B4J editor with #AdditionalJar: mssql-jdbc-6.4.0.jre8.jar
- Edit the Files/config.properties from jRDC.b4j project and edit Database Configuration:
DriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl=jdbc:sqlserver://localIPSQLServer:1433;databaseName=xxxx
User=app
Password=xxxxxxx
#Java server port
ServerPort=17178

and that's it! I run it in B4J without errors. Only if I use external SQL IP instead of local IP it fails with a "Error fetching connection."

I must go on now with tests in my B4A project, but I get some doubts about this jRDC moving process:

- If there is not framework at the server side, is the config.properties file with all programmed queries stored at the client side, inside of app?
- The ports to open at firewall in the server side now are only the 1433, isn't it? Seems 17178 port is internal at the client side...

thkx
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Only if I use external SQL IP instead of local IP it fails with a "Error fetching connection."
The ports to open at firewall in the server side now are only the 1433, isn't it? Seems 17178 port is internal at the client side...

Port 17178 is the port for he jRDC2 server, this has nothing to do with the 1433 of your SQL Server. Whatever machine you are running the jRDC2 server on must allow access to the port that your jRDC2 server listens on (in your case 17178). If your B4A apps are the only apps that access the SQL server and do it only through jRDC2, then technically you would not have to open SQL server's 1433 port up to the public (unless other tools need to access your SQL server externally).

- Download jdbc driver for SQL and copying mssql-jdbc-6.4.0.jre8.jar file to "c:\Program Files (x86)\Anywhere Software\B4J\Libraries\mssql-jdbc-6.4.0.jre8.jar"
Technically, you should never install libraries in that folder. That folder is for the libraries that come with B4J. You should always place extra libraries in the "Additional Libraries" folder. The location of this folder can be configured under Tools->Paths Configuration.

If there is not framework at the server side, is the config.properties file with all programmed queries stored at the client side, inside of app?
config.properties should only be part of the jRDC2 server. The only thing the client apps should know is the server's IP:port address. The individual queries are then accessed via the names given to them in the config.properties file.

jRDC was .NET?
I'm wrong about that. Looks like the original RDC was provided as a precompiled Java solution that came with a batch file to start it. jRDC was the B4J implementation of the original RDC. If you used jRDC, you had to compile it, so jRDC2 should hardly be different in the installation process as compared to jRDC. All three have config.poperties files that look identical.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
I get that error from own server browser, but from PC win B4A project seems works fine!
I'm going to adaptate the rest of B4A code to new DBRequestManager.

Thanks!
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
unknown method

Powered by Jetty:// 9.4.z-SNAPSHOT

I don't find info about this error, any hint?
FYI:
This is actually a correct response from the jRDC2 server itself. Accessing the /rdc URL is a tad more involved than /test and is technically not designed to be accessed from the browser. That is what /test is for. The /rdc URLs should be something like (I'm using your IP)
and, if you enable version 1 support (which you may want to do for the transition period)
When accessing these URLs, jRDC2 expected one or more serialized DBCommand's (query2 and batch2 methods).
Here is the code that creates that response (when no appropriate method has been included in the URL):
B4X:
       Else
           Log("Unknown method: " & method)
           resp.SendError(500, "unknown method")
       End If
 
Upvote 0
Top