In this example we have an existing Database that contains data we want to surface in a Volt application. I will be demonstrating how I connected to an Oracle database.
Create Link Connector
Launch the HCL Link admin page, http://localhost:9990/login (In my deployment I changed the port).
Make sure that you are working with the “_app_volt” project and “deploy_action=true” in the url. I set a bookmark that has the relevant url suffix, http://localhost:9990/workspace?_p=60a4454d8f331f240bfea01b&app=_app_volt&deploy_action=true.
Close the popup dialog that shows when the page first loads.
On the bottom of the screen click “Connections”, and then “New”.
5. Select “JDBC” from the list of available types and click “Next”:
6. For the connection properties provide the URL, as a jdbc connection string, and the user and password to connect to the database.
7. Enter a meaningful name and description for the Connection.
The name will appear in the HCL Volt Service Catalog dropdown, therefore it should be something that is easily recognized and understood by those that will use it.
Create an Action
8. The Connection now appears in the Connection List. Expand the Connection List, hover over “Oracle”, click on the 3 vertical dots and click “New Action”.
9. We are creating an action where the content in the database table is the source. Select “Source” for the Action Type and click Next.
10. In the Properties section:
i) Select “Table” as the Source.
ii) In my case Catalog is empty.
iii) For Schema, click the “Fetch” button. This connect to the database and load the schemas it finds. Select the correct one.
iv) For Table, click the “Fetch” button. This connect to the database and load the tables it finds. Select the correct one.
v) The rest of the properties can be left to their default values.
vi) Click Next.
11. In the Schema section, select New, enter a name, and click “Generate”. The Schema Type dropdown will show you the structure of the database table. The value that you select here will change the output of the service. In this case we want all the rows to be returned, therefore select “RowSet” as the Schema Type and click Next.
12. In the Identification section provide a meaningful name and description.
This detail will be shown in the Volt UI and used to identify the service. Note: As a service is updated in Link, Volt will report the version of that service and the last time that it was updated. It is important to note that all previous versions of a Link service can be executed, therefore updating a Link service will not break any apps that are using it.
13. When you click OK, as long as you have “deploy_action=true” in the URL, a popup will appear and show the progress of the Action being deployed.
14. The Connection and Action will now appear in Volt. There is a task that runs every 6 minutes to update the content from Link to Volt. You may also restart the Domino HTTP task if you want the Link content to appear in Volt immediately.
15. You are now ready to use the Link Connector/Action!
Setup Service in Volt
16. Create a table on your form canvas and add as many fields as you have columns in the database table (or just the ones you care about, in my case is 3). In the table properties, under Events click the onShow event. Click “Call a Service” and then click “Add/Edit Service Configuration”.
Note: You may also create the service from the Settings tab. Under Services select the form that will contain the service. Click Add Service Configuration.
17. Select “Select from Service Catalog”, select your database connection (for me it is “Oracle”) from the Service Catalog dropdown, select the action (for me it is “List Help”) and click Next.
18. Click Next as there are no Inputs for this service.
19. Map The output parameters to the columns of the table.
20. Save and Preview the form. When the form loads you should see all the colors appear in the dropdown.
21. You are all done! You have successfully pulled data from a database into your Volt application from HCL Link.
0 Comments