With Kony Fabric database adapter, you can connect to your own database as an endpoint. After you configure the database adapter in Kony Fabric Console, you can perform create, read, update, and delete (CRUD and Binary CRUD) operations on data in the tables and invoke stored procedures, functions, and views.
For example, banks maintain a store of users and their details. With Kony Fabric database adapter, banks can connect to their own databases and manage customers data.
Following are the advantages of using Kony Fabric Database Adapter:
Binary Support is available in Database Adapter with Range header.
$filter, $orderby, $top, $skip
, $select,$expand
, $batchsize
, and $batchid
.Note: From V8 SP4 FP2 onwards, Kony supports $batchsize and $batchid for MySQL database.
Note: You must provide the required batch size to the $batchsize parameter.
Note: If you set $batchsize in the first batch call, the response of the batch generates details for the nextBatchId and hasMoreRecords. If the hasMoreRecords is set to true in the response, for the second batch call onwards, you must specify the $batchid with the value of nextBatchId. It indicates that there are more records to be downloaded in the next batch.
Kony supports ODATA parameter $filter
for the Delete operation.
You can execute custom SQL queries if you want to operate on multiple tables through single operation like Joins.
Creating a database adapter involves the following steps:
How to Configure a Service Definition for a Database Service
To configure the Database Adapter in the Integration service definition tab, follow these steps:
If you select Database, the Database Type, Database Connection URL,and other details are displayed.
Note: XML is selected, by default.
Field Name | Description |
---|---|
Database | Type the database driver class details manually in the box
|
Database Connection URL | Type the connection URL in the format given in the help text. The connection URL of the supported database types are as follows:
|
User ID | Type the user ID for the connection URL. |
Password | Type the password for the user ID which you have entered. |
Advanced Settings | Specify the advanced settings like Soft Delete Flag and Autogenerated fields. {'softdeleteflag':'<columnName>', 'softdeleteactivevalue':<active-value>, 'softdeleteinactivevalue':<inactive-value>, 'AutogeneratedFields': {'TableName': ['Field1Name','field2Name'...] } {"issoftdeletedefault ": "false", Note: When the lastupdatetimestamp is set, the RDBMS adapter identifies this column as the ChangeTrackingColumn to track delta/updated records. All the objects in the given Object Service must have the same ChangeTracking column name.
|
Max Pool Size | Specify maximum number of connections in the connection pool. |
Connection Timeout (ms) | Type the connection timeout in milliseconds. |
=> V8.3
.Field | Description |
---|---|
Custom Code | To specify a JAR associated to the service, select one from the Select Existing JAR drop-down menu or click Upload New to add a new JAR file. Make sure that you upload a custom JAR file that is built on the same JDK version used for installing Kony Fabric Integration. |
API Throttling |
|
Note: All options in the Advanced section are optional.
The Operations List tab appears only after the service definition is saved.
Note: Click Operations List tab > Configure Operation. The Configured Operations list appears.
Note: To use an existing integration service, refer to How to Use an Existing Integration Service.
Field | Description |
---|---|
Schema | Select the schema loaded based on your database configuration. |
Object Type | Select the object from the list.
Note: While adding operations to a database integration service, Kony Fabric allows you to select CRUD operations only for table and view object types. |
Object | Select the checkboxes for the selected object type. You can select one or more objects. |
Operations | From the operations list, select the required check boxes for CRUD operations for tables. For views, only GET is supported. You can select one or more CRUD operations. |
Operation names are auto-generated in the format. The default name format of a database operation is <schema_name>_<table_name>_<operations>
. You can change the operation name if required.
For example, RdbmsDetails_CustomerDetails_create
.
When an admin creates CRUD operations for a database adapter, the admin is under a particular schema. To customize fields, refer to How to Configure CRUD Operations for Database Service.
After you create an Database service, configure CRUD operations as following:
Under Configured Operations list, hover your cursor over the create operation and click Settings (the three dots) >> Edit.
Note: To edit an operation, you can also click the operation from the service tree pane.
The system displays the selected operation in the edit mode. You can perform following actions in this window:
To make duplicate entries, select the check box for the entry, click Copy, and then click Paste.
Fields | Description |
---|---|
Name | The Name field is pre-populated with fields names of the selected database. You can edit this field. |
Operation Security Level | It specifies how a client must authenticate to invoke this operation. Select one of the following security operations in the Operation Security Level field.
Note: The field is set to Authenticated App User, by default. |
Action | The field is pre-populated with operation names of the selected database. You cannot edit this field. |
Custom Code Invocation | You can add pre and post processing logic to services to modify the request inputs. When you test, the services details of various stages in the service execution are presented to you for better debugging. All options in the Advanced section are optional. For more details, refer to Preprocessor and Postprocessor. |
Additional Configuration Properties | Additional Configuration Properties allows you to configure service call time out cache response. For information on different types of configuration properties, refer Properties. |
Front-end API | Front-end API allows you map your endpoint (or) backend URL of an operation to a front-end URL. For detailed information, refer Custom Front-end URL. |
Server Events | Using Server Events you can configure this service to trigger or process server side events. For detailed information, refer Server Events. |
Note: All options in the Advanced section for operations are optional.
Integration services accept only form-url-encoded
inputs for all input parameters provided in service input parameters (request input).
Field | Description |
---|---|
TEST VALUE | Enter a value. A test value is used for testing the service. |
DEFAULT VALUE | Enter the value, if required. The default value will be used if the test value is empty. |
SCOPE | Select request or session. This field is set to Request, by default. |
DATA TYPE | The default datatype for the selected column is loaded under DATATYPE field. |
Encode | Select the checkbox to enable an input parameter to be encoded. For example, the name New York Times would be encoded as New%20York%20Times when the encoding is set to True. The encoding must also adhere the HTML URL encoding standards. |
Description | Enter the description for request input. |
Note: You can view the service in the Data Panel feature of Kony Visualizer. By using the Data Panel, you can link back-end data services to your application UI elements seamlessly with low-code to no code. For more information on Data Panel, click here.
The system displays the selected operation in the edit mode. The Read operation has the Request Input and Response Output tabs.
Note: You can add an entry by clicking the Add Parameter button if entries for the input and the output tabs do not exist.
In the read operation, the Name drop-down list contains a Select option that acts as a label for the list. Select itself is not a command.
- To make duplicate entries, select the check box for the entry, click Copy, and then click Paste.
- To delete an entry, select the check box for an entry, and then click the Delete button.
In the Request Input, configure the following ODATA commands to filter the data:
For example (sample employee table), shown below:
Command Name | Test value for the command | Result |
---|---|---|
$filter | emp_Id ge 30 | Filters and displays data in the table based on age of employes who are older than 30. |
$orderby | emp_Age | Arranges data in the table based on employees' age. |
$top | 5 | Displays top five records in the table. |
$skip | 5 | Displays all records in the table except top five records. |
For example (sample configuration for ODATA commands), shown below:
To configure the Response Output operation, provide the following details .
Field | Description |
---|---|
Name |
The Name field in the Response Output tab is pre-populated with database columns |
Scope |
Select request or session. This field is set to Request, by default. Note: If you define parameters inside a record as the session, the session scope will not get reflected for the parameters. |
DATA TYPE | The default datatype for the selected column is loaded under DATATYPE field. |
Description | Enter the description for response output. |
Note: You can view the service in the Data Panel feature of Kony Visualizer. By using the Data Panel, you can link back-end data services to your application UI elements seamlessly with low-code to no code. For more information on Data Panel, click here.
The system displays the selected operation in the edit mode. The update operation has the Request Input tab.
The NAME field contains primary key of the table. You cannot modify these details.
The Name column is prepopulated with fields names in the database.
Note: You can add an entry by clicking the Add Parameter button if entries for the input and the output tabs do not exist.
- To make duplicate entries, select the check box for the entry, click Copy, and then click Paste.
- To delete an entry, select the check box for an entry, and then click the Delete button.
To validate the details, click Fetch Response. The result of the operation appears.
Click SAVE OPERATION to save the changes in the update operation.
The system displays the selected operation in the edit mode. The delete operation has the Request Input tab.
The system displays the selected operation in the edit mode. The delete operation has the Request Input tab.
The NAME field contains the primary key of the table. You cannot modify these details. The Request Input tab contains only the primary key of the table.
Click Fetch Response to validate the details. If the test value matches the primary key in the database, the system deletes the record from the database.
Click SAVE OPERATION to save the changes in the delete operation.
If you want to write your own SQL query in the operation, do the following:
Perform the following steps to write a custom query:
Note: Currently only MySql, SQL Server, Oracle and PostgreSQL are supported.
Select * from KONYUNITTESTDATABASE.products where LASTUPDATETIME > @timestamp and SOFTDELETEFLAG = @boolean limit 100;
Important: Make sure that you always provide a limit in the query to prevent server overload.
Note: If there are no output parameters mentioned, then you will get the query result set as is from the adapter.
Important: If any error occurs in the database due to the SQL query, Kony Fabric will return the same error message which it receives from the database. If the error message contains any sensitive information, it is the responsibility of the developer to handle the sensitive information and display a generic error message.
Limitations
Following are the limitations to use the Kony Fabric Database Adapter:
Table Valued MSSQL server functions are not supported from Kony Database adapter
Any CRUD operation can be performed on only one record at a time based on Primary Key.
For related tables, you can perform hierarchical Create/update/read.
$top
in case of Oracle DB follows the ordering imposed by the backend, unless a $orderby
is specified.
$expand
on self-referenced table is not supported.
Kony supports eq
, ne
, lt
, le
, gt
, ge
, and or
operators with the $filter
ODATA parameter.
$expand
fails, if any related table has binary (bolb (or) bit) columns where MySQL itself fails to convert the binary data into a valid JSON.group_concat()
. To resolve the issue, you must configure a higher value than the max payload size for group_concat_max_len
property.$expand
ODATA parameter, the database adapter supports multi-level query for related tables. This is applicable for objects services as well.Important: For Kony Fabric V8 SP2 or below versions, the following are the limitations with $expand
:
- For SQL Server, Oracle, and PostgreSQL databases, $expand
is limited to one level.
- For using the $expand
ODATA parameter, MySQL version must be 5.7.7+.
- For SQL Server, the $expand
with a column of type timestamp
is not supported.
- For PostgreSQL, the $expand
with a column of type Boolean
is not supported.
Note: Open Data Protocol (OData) is an open protocol to allow the creation and consumption of queryable and interoperable RESTful APIs in a simple and standard way. For more details, refer to http://www.odata.org/
<set-param inputpath="nextBatchId" outputpath="nextBatchId"/>
<set-param inputpath="hasMoreRecords" outputpath="hasMoreRecords"/>
Note: If you specify $orderby, $orderby with ChangeTrackingColumn is executed first followed by your $orderby value.
Note: The number of records downloaded can be more than the batch size. This is because the records are downloaded with a timestamp equal to the last record's timestamp of the current batch.
Copyright © 2020 Kony, Inc. All rights reserved. |