SK SKYVVA Documentation

3. Database Adapter

Introduction

The conceptualization of a new Database Adapter on Agent V3 is the same as JDBC Adapter on the old Agent. It used as a connector to transfer data from Salesforce to Database and from Database to Salesforce. Any Connect or Agent V3 currently supports many types of Databases such as Oracle, Ms Access, SQL Server, MySQL, and PostgreSQL.

The user will learn how to send data in multiple objects from Salesforce to the multi-table in the database synchronously and asynchronously through Agent V3 or Any Connect. The user will know about Transactional and Non-Transaction mode during processing. Creating an adapter, called Database Adapter within Internal Key Management for insert a record to the database. MYSQL Database is used for example below to Insert a record to the database and it located on EC2 instance. Pre-required

Case1

–  How to do insert operation using a Synchronous and Asynchronous outbound interface?

Since the user now completely understand; How to use the Insert Operation, by hitting the upper link. – What is an Integration and How to create it? Since the user now completely understand; How to create Integration, by hitting the upper link. Step2: Click on Agent Control Board TabHow to use the Agent Control Board?

Since the user now completely understand; How to use the Agent Control Board, by hitting the upper link, now we understand the Architect of the Agent Control Board now follows below on Salesforce org. Step-3: Create an outbound Database Adapter on the new Agent Control Board

Name: any name

* on EC2, make sure you have allowed MYSQL port 3306 on Group Policy for connectivity from other systems.

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]

[/su_box] Step-4 Generate Message Type from the database –  How to create a message type?

Since the user now completely understand; How to create a message type, by hitting the upper link.

Agent Instance: your instance name

[su_box title="For Insert operation, we have a template for generating Message Type for a single Table" box_color="#2a8af0" title_color="#000000"]

[/su_box] [su_box title="Note" box_color="#2a8af0" title_color="#000000"] [/su_box] Step-5 Setup Interface – What is an interface and how to create it?

Since the user now completely understand; How to create an Interface, by hitting the upper link.

Create outbound Interface for Synchronous mode, operation(insert), choose Adapter, Metadata Provider, Repository, and Message Type (Request) We need to define a response Interface because of INSERT operation within the Internal Key Management mode, the value of the Primary Key did not send from Salesforce, it is auto-generated by the database. In this case, Agent will return the Id (Primary Key) to Salesforce. The user can take this response to do Inbound V3. For example, the user can update the existing Account’s object to make sure the record on Salesforce and database, are the same. Adding Response Interface (Inbound) to Request Interface (Outbound) Step- 6: Checking Cache record to ensure it synchronized to new Agent. Go to Agent control board then click Cache Monitor – How to use Cache Monitoring on Agent Control Board?

Since the user now completely understand; How to use Cache Monitoring , by hitting the upper link.

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]We are using Cache on a new Agent for storing the SKYVVA object and its setting, so the new Agent will be looking to Cache record on its local database (H2 Database) to get the SKYVVA object’s setting before transfer data. It is different from the old Agent that is always read the SKYVVA object’s setting from Salesforce again and again that it makes too much time before transfer data. The Cache is built automatically when the Interface has linked to which Adapter has a connection destination. [/su_box] Step-7:  Callout v3

[aux_code language="javascript" theme="tomorrow"  extra_classes=""] skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl(); c.returnJSONComplete=true; c.actionDoIntegrate=true; c.isCreateMessage=true; String[] ids= new String[]{'0014E00001C8fAwQAJ'};//Account Id skyvvasolutions.Iservices.invokeCalloutV3('Test MYSQL-Database Integration','MYSQL_Database_InternalKEY_Insert_SYNC_multiple table',ids,'SYNC',c); [/aux_code] In this example field “DB_AccountId” is the primary key of Table “tbl_account_db_atn

How to do insert operation using an Asynchronous outbound interface?

In this example, we use the same Interface as we have practiced for the Synchronous scenario, just change the processing mode to Asynchronous on Interface then Callout v3.

[su_box title="Note" box_color="#2a8af0" title_color="#000000"] For Asynchronous mode with Outbound Interface is a dependency on the field “Transfer Package Size” on the Interface. By default, this field is blank mean that the value “1”. The calculation of API call is depending on this field. For example, in case we are sending 3 records Account’s id: [/su_box] We create another inbound Database Adapter that connects to the database in as inbound direction then add it to the Response Interface Navigate to Setup gear icon => Developer Console => Debug menu => Open Execute Anonymous Window then put code for update Account object then click the Execute button. [aux_code language="javascript" theme="tomorrow" extra_classes=""] skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl(); c.returnJSONComplete=true; c.actionDoIntegrate=true; c.isCreateMessage=true; String[] ids= new String[]{'0011X00000hPU1iQAG'};//Account Id skyvvasolutions.Iservices.invokeCalloutV3('Test MYSQL-Database Integration','MYSQL_Database_InternalKEY_Insert_SYNC_multiple table',ids,'Auto',c); [/aux_code] [su_box title="Note" box_color="#2a8af0" title_color="#000000"] If your data contain much more, so you cannot process it by Synchronous call due to the request time out error, we need an Asynchronous. In the Asynchronous call, multi-task does at the same time in the background job, the user no need to wait to see the response back. In this case, Agent will be responding to the update message Complete or Failed for a while. [/su_box] After callout, the record is inserted into the database then its response back to update the relevant object. As shown the result on Message Monitoring below:

Insert operation and Transactional mode

Normally, when we creating a new Interface the field “isTransactional” is unchecked it means that Non- Transactional Mode. If that field is checked then it is Transactional mode.

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]

The example below has shown the Non-transactional Mode which is one message is failed to insert. The example below is used the same message scenario for non-transactional Mode, it just switching to Transactional Mode. In Transactional Mode, when one message is unable to do any database operation then it makes another message which is complete to rollback and marked the whole tree as Failed status. We explain here how to do INSERT operation using Synchronous and Asynchronous outbound interface. We have understood how to create a Database Adapter, generate Message Type from the database table, Primary Key and Foreign Key on Mapping too, Internal Key and External Key Management, response Interface, and callout V3 to the Agent.

Case2

-How to do update operation using an Asynchronous / Synchronous outbound interface?

Since the user now completely understand; How to use the Update operation, by hitting the upper link. Users can use the same Database Adapter in the previous section as it used for INSERT operation. Now we use that Adapter for UPDATE operation.

We explain here how to do UPDATE operation using a Synchronous and Asynchronous outbound interface. We have understood about Message Type in WHERE-Clause, knowing about putting value in WHERE-Clause on mapping tool, and callout V3 to Agent. And we also have known about Transactional Mode.

Case3

-How to do delete operation using an Asynchronous / Synchronous outbound interface?

Since the user now completely understand; How to use Delete operation, by hitting the upper link. Users can use the same Database Adapter in the previous section as it used for INSERT operation. Now we use that Adapter for DELETE operation.

We explain here how to do UPDATE operation using a Synchronous and Asynchronous outbound interface. We have understood about message type in WHERE-Clause, knowing about putting value in WHERE-Clause on mapping tool, and callout V3 to Agent. And we also have known about Transactional Mode.

Case4

-How to do Select operation using an Asynchronous / Synchronous outbound interface?

Since the user now completely understand; How to use Select opertaion, by hitting the upper link. Users can use the same Database Adapter in the previous section as it used for INSERT operation. Now we use that Adapter for QUERY operation.

We explain here how to do select operation QUERY using Synchronous and Asynchronous outbound interface. We have understood about Message Type in WHERE-Clause, knowing about putting value in WHERE condition in mapping tool, Database Query’s field, and callout V3 to Agent.

Case5

–   How to call Stored Procedure on a new Agent?

Since the user now completely understand; How to call Stored Procedure, by hitting the upper link. Users can use the same Database Adapter in the previous section as it used for call INSERT Procedure. Now we use that Adapter for  Stored operation.

A stored procedure is a set of SQL statements with an assigned name, which are stored in an RDBMS as a group, so it can be reused and shared by multiple programs. Stored procedures can access or modify data in a database, but it is not tied to a specific database or object, which offers a number of advantages. Users can use the ORACLE database as an example. In here, when we call the Stored Procedure to the Database to do any database operation, we have expected it will respond back the result to the Salesforce. In this case, we need to have the INPUT and OUTPUT parameters in the Stored Procedure and create a Request and Response Interface corresponding to those parameter types. The ORACLE database located on an EC2 instance and the Stored Procedure was written to Insert new data if no record present on the Database and update data if the record exists. Check the result on Message Monitoring The Stored Procedure has been executed and response to Salesforce correctly

We call how to call Stored Procedure from Salesforce to the database, and respond to the Salesforce, we have known how the Message type structure generated from the Database.

Case6

Ms Access database

The users can create databases to store and organize large amounts of data in a structured manner. It offers various features such as tables, forms, queries, reports, and macros to facilitate data entry, manipulation, and analysis. Users can define relational and tween tables, enforce data integrity rules, and create user-friendly interfaces to interact with the data.

The Ms Access adapter detail

The MS Access adapter is a software component that facilitates the integration and communication between Microsoft Access with SKYVVA Agent databases. It acts as a bridge, allowing Access to connect with SKYVVA Agent, such as SQL servers, Oracle databases etc. The Ms Access Adapter provides a set of tools and functionality that enables users to import, export, and manipulate data between Access with SKYVVA Agent. It allows Access users to establish connections, retrieve data, perform queries, and update records in SKYVVA Agent. By using the MS Access adapter, users can leverage the features and capabilities of Access while seamlessly working with data from SKYVVA Agent. It simplifies data management tasks, enhances data sharing and collaboration, and expands the possibilities of Access by enabling integration with SKYVVA Agent.

Ms Access is a relational database management system (RDBMS) developed by Microsoft. It allows users to store, manage, and manipulate data using a graphical user interface. SKYVVA Agent, on the other hand, is a data integration tool that enables seamless communication and integration between different systems.

Inbound Adapter

Outbound Adapter

If you want to integrate Ms Access with SKYVVA integration app, user have a few options:

Open this article in the interactive viewer →