Design > Designing Service Connectors > Creating a Data Access Service Connector
  

Creating a Data Access Service Connector

You can create a data access service connector on a Secure Agent to access data directly from a database.
You can use a data access service connector to connect to the following databases:
Note: Use a personal access token (PAT) to connect to the Databricks database. For more information about the various limitations in connecting to Databricks, see Rules and guidelines for Databricks.
You can create a data access service connector by defining the properties and specifying variables to interact directly with the database. You can also define the actions associated with a data access service connector.
Before you create a data access service connector, you must copy the required JDBC JAR files to the following directory and restart the Secure Agent:
<Secure Agent installation directory>/apps/process-engine/ext
Download the following JDBC JAR files based on the database that you use:
Database name
JAR files
Databricks
DatabricksJDBC42.jar
IBM DB2
db2jcc4.jar
MySQL
mysql-connector-java-5.1.40-bin.jar
Oracle
ojdbc8.jar
SQL Server
sqljdbc41.jar
Note: The JAR files must be compatible with the database version that you use.
To create a data access service connector, perform the following steps:
  1. 1In Application Integration, click New > Service Connectors.
  2. 2In the New Asset dialog box, click Data Access Service Connector using Form, and then click Create.
  3. The image shows the New Asset dialog box.

Defining Properties

To create a data access service connector and define the properties, perform the following steps:
  1. 1In Application Integration, click New > Service Connectors > Data Access Service Connector using Form > Create.
  2. The data access service connector editor appears.
    The following image shows the data access service connector editor:
    The image shows the data access service connector editor
  3. 2On the Definition tab, define the following basic properties for the data access service connector:
  4. For more information about properties related to app connections, see Design
    After you publish the app connection, you can view the OData Service URL and OData Swagger URL in the Properties Detail page of the app connection.
  5. 3In the Connection Properties section, define the following general properties to connect to an external database:
  6. 4Optionally, in the Connection Properties section, define the following advanced properties :

Specifying Variables

To configure a data access service connector, you might need to specify variables to define output fields.

Built-in Variables

You can reference the following variables in a data access service connector using an XQuery expression:
Variable
Variable Type
Description
$VariableName
All connection properties
Input and output fields can be specified using this format.
$Response
Output field mapping
Contains the Response XML data. It is displayed on the Test Results tab of the data access service connector.

Defining Actions

On the Actions tab, you can create and describe one or more actions associated with a data access service connector.
The following image shows the Actions tab:
The image shows the Actions tab.
Click the row that you want to edit or click + to add a new row, and then enter the following information on the Action tab:
For each action, specify additional details on the Input, SQL Binding, Output, and Test Results tabs.

Input Tab

Use the Input tab to define input data items that are unique to the service to which you are sending data.
The following image shows the Input tab:
The image shows the Input tab.
For each item, enter the following properties:
Use the + icon to add a new item. Click X to delete the current row.

SQL Binding Tab

For each action in a data access service connector, use the SQL Binding tab to specify multiple SQL queries to access the data from the data source. After the SQL entries are made, the tab displays details such as the SQL name, SQL text, column case of the expression, query type, maximum rows returned by the SQL query, and maximum wait time in seconds.
When you add multiple queries, the statements are executed in the order in which the queries are listed in the table. You can use the arrow buttons to move a query up or down. You can also delete SQL queries.
To add a row of an SQL entry, click + on the SQL Binding tab. Enter the following details for each SQL query:
SQL Name
Name of the SQL query.
SQL Text
A valid SQL statement that returns at least one row.
Column Case
Specify whether the characters in the expression must be converted into lowercase or uppercase, or remain unchanged. Default is Lowercase.
Type
Select one of the following values:
Has Result Set
Reserved for future use.
Maximum Rows
The maximum number of rows returned by the SQL query that can be displayed in the SQL response payload. Default is 100 rows. The maximum number of rows can't exceed 10,000 rows.
Max Wait (Seconds)
The maximum length of time in seconds that a database client can wait for a response from the database before timing out the session.
Note: Application Integration does not perform a commit after it executes every SQL query. To help with a rollback in case of an SQL query failure, the commit is done only at the end after all the SQL queries are executed. In a few databases, implicit commit occurs for DDL statements such as CREATE TABLE, DROP TABLE, and so on. These executions can't be rolled back.

Configuring multiple SQL queries

Perform the following steps to add and edit SQL queries:
    1On the SQL Binding tab, click the + icon to add an SQL entry.
    An SQL entry is added to the table.
    2Click the Edit icon to edit the SQL query.
    The Create SQL page appears. The following image shows the Create SQL page where you can configure multiple SQL queries:This image shows the Create SQL page.
    3In the Create SQLpage, configure the SQL query properties such as the SQL name, SQL query, column case of the query, query type, maximum rows, and maximum wait time.
    You can use SQL queries to perform various data manipulation operations such as SELECT, INSERT, DELETE, and UPDATE. You can parameterize an input field in an SQL query. Use the following syntax to parameterize an input field at run time:
    '{$<input_field_name>}'
    For example, if empId is the name of an input field, enter the following SQL query to parameterize the empId field:
    select * from employee.contact where id = '{$empid}'
    4Click Create.

SQL query response format

In a data access service connector, the XML response for single and multiple SQL queries begins with the multiDataAccessResponse tag.
The following sample snippet shows the format as the process or data access service output:

<multiDataAccessResponse xmlns:aetgt="http://schemas.informatica.com/socrates/data-services/2014/05/business-connector-model.xsd"
xmlns:bconn="http://schemas.informatica.com/socrates/data-services/2014/05/business-connector-model.xsd">
<dataAccessResponse>
<result>
<statementId>SQL Name 1</statementId>
<row>
<updatedRows>0</updatedRows>
</row>
</result>
</dataAccessResponse>
<dataAccessResponse>
<result>
<statementId>SQL Name 2</statementId>
<row>
<updatedRows>1</updatedRows>
</row>
</result>
</dataAccessResponse>
</multiDataAccessResponse>
The following sample snippet shows the XML format as the response payload:

<multiDataAccessResponse>
<dataAccessResponse>
<result statementId="SQL Name 1">
<row>
<updatedRows>0</updatedRows>
</row>
</result>
</dataAccessResponse>
<dataAccessResponse>
<result statementId="SQL Name 2">
<row>
<updatedRows>1</updatedRows>
</row>
</result>
</dataAccessResponse>
</multiDataAccessResponse>

Output Tab

Use the Output tab to define how the data access service connector must parse data returned from the database.
The following image shows the Output tab:
The image shows the Output tab.
For each output data item, specify the following properties:

Creating Process Objects

On the Process Objects tab, you can define one or more process objects for a data access service connector to group data and create a structured object. When defined in the data access service connector, the process objects are available to processes that use the data access service connector. For example, if a database returns demographic information such as name, address, and phone number, you might create a single demographic process object that contains this information.
You can associate each process object with one or more of the data elements returned by the database using the Actions/Output tab.
To create data access service connector process objects, perform the following steps:
  1. 1Create or open an existing data access service connector.
  2. 2Click the Process Objects tab.
  3. 3Click + to add a new process object or select an existing process object from the list. Each process object appears as a line item on the tab.
  4. The following image shows the Process Objects tab:
    The image shows the Process Objects tab.
  5. 4On the Properties tab, specify the following details for each process object:
  6. 5On the Fields tab, specify the following details for each process object:

Testing the data access service connector

When you use the data access service connector editor, click Test to send a request to the database and display the response data on the Test Results tab:
If the response includes one or more attachments, you can also download the attachments.
Note: The Response Payload and SQL Response sections show a maximum of 10,000 records. You can't specify a limit greater than 10,000 on the SQL Binding tab.
The following image shows the Test Results tab:
Generate Process Objects
A process object is usually tied to a specific set of elements. You may sometimes have a large number of identical objects, each of which applies to one set of elements. For example, when you define the data being returned, you create a process object whose sole purpose is to define a subset of returned data. These objects are non-reusable and can only be used by a single process object field. The object names are also the name of a field.
You can also create objects that are reusable. For example, the refType element in NetSuite has two fields: a name and an internalID. Instead of creating many objects, each of which contains these two fields, you can create a single, reusable process object.
  1. 1Click Generate Process Objects to show the process objects that you have defined for the data access service connector.
  2. 2Select the process objects that you want to make reusable and then click Next.
  3. Process Designer displays a list of generated process objects.
  4. 3Click Finish.

Metadata parameters in response payload

To view the metadata details for a specific app connection, use the metadata parameter. The output includes contextual information about a piece of data or a data set that is stored alongside the data.
Use the following URI to view the metadata details for an app connection:
https://<Informatica Intelligent Cloud Services URL>/active-bpel/odata/v4/<app connection name>/$metadata
The following sample snippet shows the format of the response payload: This image shows the metadata paramaters in response payload.
To successfully fetch the metadata from a database that contains a large number of tables, filter the tables by using the Include Tables or Exclude Tables field when you define the connection properties in the app connection.

OData expand parameter in response payload

After you publish an app connection, you can use the OData expand parameter to perform nested queries on the data. You can query up to one level of a navigation property in a service call.
Use the following URI with the OData expand parameter:
https://<Informatica Intelligent Cloud Services URL>/active-bpel/odata/v4/<app connection name>/<table name>?$expand=*
The following sample snippet shows the output of the expand query:
This image shows the expand parameter.

Rules and guidelines for Databricks

Consider the following rules and guidelines when you use a data access service connector to connect to a Databricks database: