B4J Question Has anyone tried to connect a jRDC2 server to an oDataV4 data source?

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
I am trying to connect to a Business Central database installed on a local server.
Currently I am being able to connect directly to the database, but I would like to try to do it using their webservice with oDataV4, which is much more convenient to prepare the queries than doing it directly with SQL since it has tremendously complex table and field names, apart from of the game provided by the Flowfields with which you already get precalculated values that otherwise you also have to calculate manually when launching the standard SQL.
Thank you
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hi:

It seems there is a jDBC driver for oData, so, it’s probably you can use it

As Erel says in the jRDC2 tutorial: “jRDC2 can work with any database that provides a JDBC driver.”

 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
I am trying to make an application with B4XPages to be able to consume oDATA services from both B4J and B4A and thus be able to make direct requests from mobile devices as @DonManfred recommended.

From B4J I have already achieved it, but from B4A, it doesn't give me a compilation error and I can't go from there.

The "stuck" that I encounter and that I believe is the origin of the problem is that I have to connect to the service using NTLM authentication.

I am doing it following @Erel's instructions from this thread:

https://www.b4x.com/android/forum/t...hentication-ntlmv2-solution.66790/post-424367

The error that appears when compiling is:

B4X:
B4A Versión: 11.00
Parseando código.    (0.04s)
    Java Versión: 8
Building folders structure.    (0.03s)
Corriendo accion personalizada.    (0.99s)
Compilando código.    (0.05s)
Compilado códigos de diseños.    (0.01s)
Organizando librerías.    (0.00s)
    (AndroidX SDK)
Compilando los recursos    (0.41s)
Enlazando los recursos    (0.40s)
Compilando el código Java generado.    Error
javac 1.8.0_201
src\b4a\example\main.java:7: error: package org.apache.http.impl.auth does not exist
import org.apache.http.impl.auth.NTLMEngine;
                                ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
Here is attached a project with B4XPages.

The B4J part compiles and connects to the data source perfectly.

However, part B4A gives a compilation error and I can't test anything.

If I comment out the #if java condition, then the B4A part also compiles, but cannot access the data source because it does not accept the credentials.

Thank you.
 

Attachments

  • NTLM_OData_Project.zip
    16.8 KB · Views: 80
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
The B4A client only communicates with jRDC2 server. It is not affected by the actual db used.
And how should the data received be converted into JSON so that the jrdc2 server would return it in a standard way to the Android devices?

As far as I know, the jrdc2 server only fetches data hosted in "real" databases, not in json and similar formats.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
As far as I know, the jrdc2 server only fetches data hosted in "real" databases, not in json and similar formats.
It fetches the Data from the odbcdriver. If there is a odbcdriver for oData then the data inside the odbcdriver is not json any longer.
Using a odbcdriver you don´t have to care about json i guess. I never used oData and even not a OData-odbcdriver.
I can´t help in this regard.

If you want to work with JSON then you have to use the REST-Api i guess.
 
Upvote 0
Top