Send data back from Canvas to a external database


#1

Hi All,

We are asked if there is a way to use Canvas to send data to an external database (SQL, Talend…)? The objective is to have data input into screen on top of PA that can be send at the same moment to an external database to be used in another system.

If there is a technical possibility to make it, is there something that we can recommend or not ?
Thanks for your help.


#2

Hi @sschreurs, this link from our Code site should point you in the right direction, whilst it specifies querying, you can use any SQL syntax to send data as well.


#3

Hi @sschreurs,

As @lbrown has said you have the ability to create a Java servlet or JSP in Canvas as the back-end is an Apache Tomcat server. This enables you to build anything that you like but it takes some technical and Java knowledge.


#4

Thanks to both of you !
Do we have already any references or examples of this ?
What could be the impact in term of performance, design, others ?


#5

Hi @sschreurs,

The performance would depend on how the code was written but it would be very fast.

The steps would be:

  1. Send a JSON payload from JavaScript via a HTTP POST ($http.post) to the server.
  2. The server would convert the JSON in the message to Java objects. There are many libraries for this GSON, Jackson, etc.
  3. Use JDBC to open a connect to the database and insert records into the relevant tables by iterating over the Java objects created in step 2.