Use of Odata to connect to external database

1
Hello all, I want to connect to external database(Microsoft SQL) into Mendix app at run time without storing the data in the database. There are some activities which user does on the data and we need to send this updated data back to the external database without store it in Mendix database. so plan is to store the data from the external database in non persistant entities.  Can we use OData service to consume data using ODataApi's and show it on the user? Is there any other way we can  achieve connecting to external database.?   I did try to use database connector module. however it seems like it needs Database credentials to query. How ever  due to securitiy constraints, these credentails will not be shared and other login mechanisms to be found. Please suggest.   Regards, Nirmal Kumar
asked
4 answers
1

Hi Nirmal,

Your problem is not the technique (oData, Rest, Datahub or Java) but your problem is access-rights to the SQL-database. Those rights can be provided in the form of credentials (userid+password) or rights to use an available service. For this you need to talk to the persons/managers who are in charge of acces to the SQL-database. If they do not give you access, then it is ‘game over’.

Once they do give you access, the hard part is over and you can implement your solution.

answered
0

If you are not allowed to connect to the database directly (which I assume as you have written you do not get a user and a password for the database), you need a service to get and update data. This service must be provided by those who own the external database. It can be REST or ODATA. Both are easy to connect to with Mendix apps.

answered
0

Hi Nirmal,

 

If you want to consume OData services then you have use datahub and with that you can register your external Odata service and then you can consume using Datahub .

 

Documentation registering external OData is available you can refer that.
Consumed OData Services | Mendix Documentation

 

Thanks

answered
0

Hi Nirmal,

 

Based on the information you provided, if your external provider has a ODATA service created for you by authenticating with either user name password or via a certificate (More secured) will resolve the issue.

Once you have Odata service ready, you should be able to consume from mendix app and show as Non-persistable data in Mendix (Like you mentioned could write logic to Datagrid source microflow directly) and any data modification should call another Odata service to write back to the external server will. 

 

You need two Odata calls, one getlist and another create Odata call.

 

Also if they have a rest api, should be able to consume securely via JWT or any secured way of using works (Like auth token).

 

Hope it helps,

 

Ashok

answered