Robert van Boesschoten
Last updated: 27-08-2020
In Betty Blocks it is possible to connect via web services with all kinds of external systems. By now, it needs little explanation that this applies to external systems that are connected to the internet by means of a (public) web API. In this article we want to go a step further and explain how an external system that does not have its own web API can communicate with Betty Blocks web services.
In this case, we will discuss how to make it possible to read data in an on-premise Oracle database via the web service functionality in Betty Blocks.
To make the translation between the Oracle database (which only understands SQL) and the Betty Blocks web service (which only understands JSON APIs), a proxy is needed. Betty Blocks has an Oracle proxy available for this that can be installed on the same network as the database.
Sample code for a proxy is publicly available and can be downloaded from Github. GitHub - bettyblocks/nodejsoracleproxy.
The Oracle proxy must be set to connect to the database. For details on how to do this exactly, you can use the readme from the link above. After the proxy has started, a connection to the database is set up and at the same time a web server is started. By making this web server accessible via the internet, it can be accessed and consumed by Betty Blocks web services.
In Betty Blocks it is then possible to perform queries via the web service via the proxy on Oracle DB. First, create a Webservice where the Host setting matches the url used for the proxy.
Then add a http event to an action where the proxy is actually called upon.
As you can see, we set the Response as option to 'relations', making the data available for further processing in your Betty Blocks application.