Informatica Data Connection
Posted by Superadmin on December 11 2018 14:10:07

 

 

Informatica Data Connections Tutorial

 

Informatica PowerCenter accesses the information or data from different sources such as Flat files, XML, Relational Databases, SAP Hana, Teradata, Mainframes, Excel, and Access. Similarly, Informatica supports the same destinations to load data. This section of Informatica Tutorial covers the different types of Data Connections, and basic ETL operations.

 

  1. ODBC Connection
  2. Import Data from Relational Database
  3. How to Import Data from Flat File
  4. Import Data from Excel Workbook
  5. Move Data from One SQL Database to another Database
  6. Export Data from SQL Server to Flat File
  7. Load Data From Text File to SQL Server
  8. Load Multiple Text Files into SQL Server

Informatica ODBC Connection

 

 

In this article, we will show you, How to connect with the Relational databases using the Informatica ODBC Connection with an example. For this article, we are using the Microsoft SQL Server as our relational database.

 

TIP: Please refer Informatica Source Analyzer article to understand the Source Analyzer. 

Steps involved in Informatica ODBC Connection

From the below screenshot you can observe that we are in the Informatica Source Analyzer. Once you are in Source Analyzer, Please navigate to Source menu and select the Import from Database.. option as shown below

Informatica ODBC Connection 1

 

Once you select the Import from Database.. option, Import tables window will be opened as shown below. Currently, we don’t have any ODBC connection to select from the drop-down list. In order to add a new one, please click on the … button as shown below

Informatica ODBC Connection 2

Once you click on the … button, ODBC Data Source Administrator Window will be opened to add a new ODBC connection. Click on the Add button to do so.  

 

Informatica ODBC Connection 3

Once you click on the Add button, Create New Data Source window will be opened. Here we have an option to select the required database from the available list. As we said before, we are using SQL Server so we are selecting the DataDirect 7.1 SQL Server Wire Protocol for this example.

Informatica ODBC Connection 4

This will open the new pop up window called ODBC SQL Server Legacy Wire Protocol Driver Setup. Here we have to fill the required details to connect with our database.

Once you have done, Click the Apply button and then click OK button to close the window

NOTE: Once you fill the required details, It is always advisable to Test your connection using the Test Connection button

Informatica ODBC Connection 5

From the below screenshot, you can see our newly created Informatica ODBC Connection so click OK button. If you want to select this connection as a data source then, Please refer Database Source in Informatica article.

Informatica ODBC Connection 6

 

 

 

Database Source in Informatica

 

In this article, we will show you, How to import data from relational Databases such as Microsoft SQL Server, Oracle, Teradata etc and use them as Database source in Informatica Source Analyzer.

 

Relational Database Source in Informatica

Before we start doing anything, First connect to Informatica repository service with your Admin credentials and then Navigate to Source Analyzer. Please refer Informatica Source Analyzer article to understand the Source Analyzer. From the below screenshot you can observe that we are in the Source Analyzer. 

NOTE: Source Menu in the Menu bar will be available only when you are in the Source Analyzer section otherwise, it will be hidden

Database Source in Informatica 1

 

Once you are in Source Analyzer, Please navigate to Source menu and select the Import from Database.. option as shown below

Database SOurce in Informatica 0

Once you select the Import from Database.. option, a new window called Import tables will be opened as shown below. Please select the ODBC connection that we already created in our previous article from the drop-down list. In order to create a new one, please refer the Informatica ODBC Connection article.  

 

 

Database Source in Informatica 2

Next, We have to provide the credentials required to connect with the respective database. Here we are providing the Username and password of our Microsoft SQL Server 2014 and owner name as dbo.

Once you fill the details, please click on the connect button. This will connect the database and display the tables and Views present in the database.

Database Source in Informatica 3 

If you want to see the data from all owners then, Please change the owner name from dbo to default All. This can be done by clicking the All button below the Show Owners section

Database Source in Informatica 4

From the below screenshot you can observe that we are selecting the DimProducts table from our Adventure Works DW 2014 database. Here you can select more than one table also.

TIP: If you find difficult to track your required table(s) then, you can type the table name under the Search for tables named and click on the search button

Database Source in Informatica 5

From the below screenshot you can observe that under the Source subfolder you can see our newly created database source in Informatica and the table definition (Column Names and appropriate data types) inside our workspace.

Database Source in Informatica 6

Preview Source Data

Although we imported our source from the SQL database, before we proceed further we should preview our data. In order to preview the source data, Right click on the table definition and select the Preview data.. option from the context menu.

Database Source in Informatica 7

Once you select the Preview data.. option, Preview data window will be opened. here you have to provide the credentials (Username and password) required to connect with the respective database and click the connect button. Once you successfully connected to your database, data inside the table (here DimProducts) will be displayed as shown below 

 

Database Source in Informatica 8

Edit existing Database Source in Informatica

Although we selected the DimProducts, we may not require all the columns present in that table. To resolve this, we can edit the table by Right click on the table definition and selecting the Edit.. option from the context menu.

Database Source in Informatica 9

Once you select the Edit.. option, a new window called Edit tables will be opened as shown below. In order to alter or change the existing table, we have to navigate to Columns Tab.

For example, if you want to add new columns then, Please select the below shown button and add Column Name, Data Type, Precision (if required), Scale (if required), If it is primary key then change the Key type to primary and check mark the Not Null option (if your column doesn’t allow null values)

Database Source in Informatica 10

If you want to delete a few columns then select the unwanted columns and click the scissors button as shown below. Here we are removing a few columns for the demonstration purpose. Once you are done editing, Click OK to close the Edit tables window

Database Source in Informatica 11

From the below screenshot you can observe that we successfully deleted the unwanted columns from the source definition.

Database Source in Informatica 12

NOTE: We are removing the columns only from the Informatica Source Analyzer. This will not reflect the underlying database data.

 

 

 

Flat File Source in Informatica

 

 

 

 

In this article, we will show you, How to import data from flat files of both Delimited type, Fixed Width type and use them as Flat File source in Informatica Source Analyzer. Before we start importing data from the flat file, let us see the data inside the flat file.

 

The following screenshot will show you the same and our task is to import this comma delimited text file as the Flat File Source in Informatica. 

Flat File Source in Informatica 1

Flat File Source in Informatica

Before we start doing anything, First connect to Informatica repository service with your Admin credentials and then Navigate to Source Analyzer. Please refer Informatica Source Analyzer article to understand the Source Analyzer. From the below screenshot you can observe that we are in the Source Analyzer.

 

NOTE: Source Menu in the Menu bar will be available only when you are in the Source Analyzer section otherwise, it will be hidden

Flat File Source in Informatica 0

Once you are in Source Analyzer, Please navigate to Source menu and select the Import from File.. option as shown below  

 

 

Flat File Source in Informatica 2

Once you select the Import from File.. option, a new window called Open Flat Filewill be opened as shown below. Please select the required flat file from your local file system and click the Open button. For this example, we are selecting the GeoImport.txt file.

Flat File Source in Informatica 3

Once you click the Open button, a new pop up window called Flat File Import Wizard will be opened as shown below. This wizard can help us to specify the text format easily. First, Under Choose the file type that best describes your datasection we have to choose either a Delimited or Fixed Width option. Our text is separated by comma delimiter as we shown earlier so we are selecting a Delimited option. 

Flat File Source in Informatica 4

If you flat file contains column names as first line of data like our example file then, you have to change the Start Import at Row value from 1 to 2 otherwise keep it as 1. If you forgot to change then, while exporting this data to the database then Type casting errors will throw.

Import filed names from the first line: This option allows us to import the column names from the first line of a flat file. If your flat file contains column names as the first line of data like our example file then, by selecting this option will import column names and this will automatically change the Start Import at Row value from 1 to 2

Flat File Source in Informatica 5  

 

Within the Step 2:

Flat File Source in Informatica 6

Here, we can edit the Column Name, Data type, Length or Precision, Scale and Width. In general, we don’t do that but if you want you can do it.

Flat File Source in Informatica 7

From the below screenshot you can observe that, under the Source sub folder you can see our newly created Flat File source in Informatica and the table definition (Column Names and appropriate data types) inside our work space.

Flat File Source in Informatica 8 

 

Preview Data inside Our Flat File

Although we created our Flat File source, before we proceed further we should preview our data. In order to preview the source data, Right click on the table definition and select the Preview data.. option from the context menu.

Flat File Source in Informatica 9

Once you select the Preview data.. option, Preview data window will be opened. Please select the GeoImport.txt file as a Flat File name from your local file system and click the Open button.

Flat File Source in Informatica 10

Once you successfully selected your file, data inside the flat file (here GeoImport.txt) will be displayed as shown below

Flat File Source in Informatica 11

Edit existing Flat File Source in Informatica

Although we selected the GeoImport.txt file as source definition, there are many situations where we may not require all the columns present in that table or we may have to add extra columns. To resolve these type of situations, we can edit the table by Right click on the table definition and selecting the Edit.. option from the context menu.

Flat File Source in Informatica 12

Once you select the Edit.. option, a new window called Edit tables will be opened as show below. In order to alter or change the existing table, we have to navigate to Columns Tab.

For example, if you want to add new columns then, Please select the first button (before scissors symbol) and add Column Name, Data Type, Precision (if required), Scale (if required), If it is primary key then change the Key type to primary and check mark the Not Null option (if your column doesn’t allow null values)

Flat File Source in Informatica 13

If you want to delete columns then select the unwanted columns and click the scissors button as shown below. Here we are removing a few columns for the demonstration purpose. Once you done editing, Click OK to close the Edit tableswindow

Flat File Source in Informatica 14

From the below screenshot you can observe that, we successfully deleted the unwanted columns from our flat file source definition.

Flat File Source in Informatica 15

NOTE: We are removing the columns only from the Informatica Source Analyzer. This will not reflect the underlying flat file.

 

 

 

 

Excel Source in Informatica

 

 

 

In this article, we will show you, How to import data from Excel workbooks and use them as an Excel source in Informatica Source Analyzer. Before we start importing data from the excel file, let us see the data inside the excel sheet.

 

The following screenshot will show you the data inside the excel file. Our task is to import this excel workbook and use this data as the Excel Source in Informatica. 

Excel Source in Informatica 1

Excel Source in Informatica

Before we start doing anything, First connect to Informatica repository service with your Admin credentials and then Navigate to Source Analyzer. Please refer Informatica Source Analyzer article to understand the Source Analyzer. From the below screenshot you can observe that we are in the Source Analyzer.

 

NOTE: Source Menu in the Menu bar will be available only when you are in the Source Analyzer section otherwise, it will be hidden

Excel Source in Informatica 0

Once you are in Source Analyzer, Please navigate to Source menu and select the Import from Database.. option as shown below  

 

 

Excel as Informatica Source 0

Once you select the Import from Database.. option, Import tables window will be opened as shown below. Currently, we don’t have any ODBC connection to select from the drop-down list. In order to add a new one, please click on the … button as shown below

Excel as Informatica Source 2

Once you click on the … button, ODBC Data Source Administrator Window will be opened to add a new ODBC connection. Click on the Add button to do so. 

Excel Source in Informatica 2

Once you click on the Add button, Create New Data Source window will be opened. Here we have an option to select the required driver from the available list. As we said before, we need to import excel files so we are selecting the Driver to Microsoft Excel for this example.

Excel Source in Informatica 3

You can also select the Microsoft Excel Driver as shown below  

 

Excel Source in Informatica 0

This will open the new pop up window called ODBC Microsoft Excel Setup. Here we have to fill the required details:

Next, Click on the Select workbook.. button to select the required excel file

Excel Source in Informatica 4

Once you click on the Select workbook.. button, the following window will be opened to select the required workbooks from our local file system. Once you are done selecting, Click the OK button to close the window

Excel Source in Informatica 5 

 

From the drop-down list, Please select the ODBC connection that we created now.

Excel Source in Informatica 6

Next, we have to select the required tables from the Excel workbooks. From the below screenshot you can observe that Multi_Cast book has only one table and we are selecting the same. Here you can select more than one table also.

TIP: If you find difficult to track your required table(s) then, you can type the table name under the Search for tables named and click on the search button

Excel Source in Informatica 7

From the below screenshot you can observe that under the Source subfolder you can see our newly created Excel source in Informatica and the table definition (Column Names and appropriate data types) inside our workspace.

Excel Source in Informatica 8

Preview Data inside Our Excel Source

Although we created our Excel source, before we proceed further we should preview our data. In order to preview the source data, Right click on the table definition and select the Preview data.. option from the context menu.

Excel Source in Informatica 9

Once you select the Preview data.. option, Preview data window will be opened. Here you have to provide the credentials (if there are any) required to connect with your local file system and click the connect button. Once you successfully connected, data inside the table (here Multi_cast table) will be displayed as shown below

Excel Source in Informatica 10

Edit existing Excel Source in Informatica

Although we selected the Multi_Cast.xls file as source definition, there are many situations where we may not require all the columns present in that table or we may have to add extra columns. To resolve these type of situations, we can edit the table by Right click on the table definition and selecting the Edit.. option from the context menu.

Excel Source in Informatica 11

Selecting the Edit.. option open a new window called Edit tables as shown below. In order to alter or change the existing table, we have to navigate to Columns Tab. For example,

Excel Source in Informatica 12

NOTE: We are removing the columns only from the Informatica Source Analyzer. This will not reflect the underlying flat file.

 

Move Data from SQL Server to another in Informatica

 

 

 

In this article, we will show you, How to Move Data from SQL Server to another in Informatica with an example. For this example, we are going to use the below show data (Customers table)

 

Move Data from SQL Server to another in Informatica 1 

and the Destination table is Duplicate Cust. As you can see, it is an Empty table

Move Data from SQL Server to another in Informatica 2

 

Move Data from SQL Server to another in Informatica

Before we start configuring the Informatica to Move Data from one SQL ServerDatabase to another database. First, connect to Informatica repository service by providing the Informatica Admin Console credential.

TIP: Here you have to provide the Admin Username and password that you specified while installing the Informatica Server.

Step 1: Create a Source Definition

Once you connected successfully, Please navigate to Source Analyzer to define your Sources. As we said before, we are using Customers table from SQL Server database as our source definitions. So, go to the Source menu and select the Import from Database.. option as shown below.  

 

 

Move Data from SQL Server to another in Informatica 3

Please select the ODBC connection that will connect the Informatica with the SQL Tutorial Database. In order to create a new one, please refer Informatica ODBC Connection article.

From the below screenshot you can observe that we are selecting the Customers table from our SQL Tutorial database.

Move Data from SQL Server to another in Informatica 4 

This will add the table definition (Column Names and appropriate data types) inside our workspace under the Source Analyzer. Please refer Database Source to understand the creation of source definition

Move Data from SQL Server to another in Informatica 5

Step 2: Create Target Definition

Please navigate to Target Designer to define the Target. In this example, we are using the existing SQL table as our target definition. So, go to the Targets menu and select the Import from Database.. option as shown below.

Move Data from SQL Server to another in Informatica 6  

 

 

Please select the ODBC connection that will connect the Informatica with the SQLTest Database. In order to create a new one, please refer the Informatica ODBC Connection article.

From the below screenshot you can observe that we are selecting the DeplicateCust table from our SQLTest database. You can refer to Create Target table using Source Definition to understand the process of creating a target definition

Move Data from SQL Server to another in Informatica 7

 

Step 3: Create Mapping to move data from one Database to another

To create a new mapping, Please navigate to Mappings menu in Menu Bar and select the Create.. option.

Move Data from SQL Server to another in Informatica 8

This will open the Mapping Name window to write a unique name for this mapping. Let me write m_move_data_from_SQL_to_sql and click OK button. 

 

TIP: Please refer Informatica Mapping article to understand the procedure for creating Mapping

Move Data from SQL Server to another in Informatica 9

Drag and drop the Customers source definitions from Sources folder to the mapping designer. Once you drag the source, Power Center designer will automatically create the source qualifier for you. I suggest you refer Source Qualifier Transformation article

Next, Drag and drop the target definition from Targets folder to the mapping designer. Next, connect the source qualifier with the target definition. Please use the Autolink.. option to connect them.

Before we close the Mapping, Let us Save, and Validate the mapping by going to Mapping Menu bar, and select the Validate option.

Move Data from SQL Server to another in Informatica 10

Step 4: Create a Workflow to move data from one SQL Server to another

After we finish creating the Mapping, we have to create the workflow for it. Power Center Workflow manager provides two approaches to create a workflow.

In this example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

Move Data from SQL Server to another in Informatica 11

This will open Create Workflow window as shown below. Please provide the unique name (wf_move_from_SQL_to_SQL) and leave the default settings.

Move Data from SQL Server to another in Informatica 12

This will create a Workflow for you

Move Data from SQL Server to another in Informatica 13

Once we created the workflow, our next step is to create a session task for our mapping.

Step 4(a): Create Session to move data from one Database to another Database

There are two types of sessions in Informatica:

For this example, we created a Non-reusable Session. In order to create Non-reusable Session, Please navigate to Tasks Menu and select the Create option as shown below.

Move Data from SQL Server to another in Informatica 14

Name it as s_move_data_from_sql_to_SQL.

Move Data from SQL Server to another in Informatica 15

Once you click on the Create button, a new window called Mappings will be opened. Here you have to select the mapping that you want to associate with this session.

Move Data from SQL Server to another in Informatica 16

Please link the Start Task, and the Session Task.

Move Data from SQL Server to another in Informatica 17

Double click on the Session task will open the Edit Tasks window. Within Properties Tab, we have two common properties that we have to configure for the relational databases.

$Source connection value: This property will store the relational source information in $Source variable. So, click on the Arrow we marked below, and select the SQL Tutorial as the source information.

Move Data from SQL Server to another in Informatica 18

$Target connection value: This property will store the relational target information in $Target variable. So, click on the Arrow we marked below, and select the SQL Test target as the Target information.

Move Data from SQL Server to another in Informatica 19

Within the mappings tab, we have to configure the Source, target Connections and some common properties. First, let us configure the source connections by clicking on the SQ_Customers source present in the Sources folder.

Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable that we created in our previous step i.e., $Source

Move Data from SQL Server to another in Informatica 20

Now, we have to configure the Target Connection. So, let us configure the target connection by clicking on the DuplicateCust present in the Targets folder.

Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable that we created in our previous step i.e., $Target

Move Data from SQL Server to another in Informatica 21

We are changing the Target Load Type to Normal.

Move Data from SQL Server to another in Informatica 22

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow. Now, Let me start the Workflow. To do so, navigate to the Workflows menu, and select the Start Workflow option.

Once you select the Start Workflow option, Informatica PowerCenter Workflow monitor will be opened to monitor the workflow. From the below screenshot you can observe that our workflow is executed without any errors.

Move Data from SQL Server to another in Informatica 23

Let us open the SQL Server Management Studio to check whether we successfully transfer the data from a source or not.

Move Data from SQL Server to another in Informatica 24

 

 

Export Data from SQL Server to Flat File in Informatica

In this article, we will show you how to Export Data from SQL Server to Flat File in Informatica with an example. For this Informatica Export Data from SQL Server to Flat File example, we are going to use the below show data (Employe table)

Export Data from SQL Server to Flat File in Informatica 1

Export Data from SQL Server to Flat File in Informatica

Before we start configuring the Informatica to Export Data from SQL Server to Text File (or Flat File). First, connect to Informatica repository service by providing the Informatica Admin Console Username and password you specified while installing the Informatica Server.

Step 1: Create a Source Definition to export data from SQL to Flat File in Informatica

Please navigate to Source Analyzer to define your Informatica Sources. As we said before, we are using the Employee table present in the SQL Server database as our source definitions. So, go to the Source menu and select the Import from Database.. option.

Export Data from SQL Server to Flat File in Informatica 2

Please select the ODBC connection that will connect the Informatica with the SQL Tutorial Database. To create a new one, please refer to the Informatica ODBC Connection article.

From the below screenshot, we are selecting the Employee table from our SQL Tutorial database.

Export Data from SQL Server to Flat File in Informatica 3

It will add the table definition (Column Names, and appropriate data types) inside our workspace under the Source Analyzer. Please refer Database Source to understand the creation of source definition

Export Data from SQL Server to Flat File in Informatica 4

Step 2: Create Target Definition to move data from SQL to Text File in Informatica

Please navigate to Target Designer to define the Target. In this Informatica Export Data from SQL Server to Flat File example, our task is to create a Text File target. So, go to the Targets menu and select the Create option.

Export Data from SQL Server to Flat File in Informatica 5

Once you select the Create option, a new window called Create Target table displayed. Please provide a unique name for the target table, and select the database type as Flat File. 

Once you complete, Please click on the Create button to create a new empty table in our PowerCenter Target Designer.

Export Data from SQL Server to Flat File in Informatica 6

From the below screenshot, see that we successfully created a new empty table in our Target Designer.

Export Data from SQL Server to Flat File in Informatica 7

To add new columns, we have to edit the table definition. It can be done by Right-click on the table, and select the Edit.. option from the context menu. Once you select the Edit.. option, a new window called Edit tables will open.

By default, Flat File columns separated by the Comma Delimiter. But, you can control the same by clicking the Advanced button

Export Data from SQL Server to Flat File in Informatica 8

Here, you can change the Column Delimiter, and you can add Single Quoted, or double quotes each column value.

Export Data from SQL Server to Flat File in Informatica 9

Next, go to the Columns Tab to add new columns. Please select the first button (before the scissors symbol). It will open the empty row to add Column Name, Data Type, Precision (if required), Scale (if needed).

If it is a primary key, change the Key type to primary and check to mark the Not Null option (if your column doesn’t allow null values)

Export Data from SQL Server to Flat File in Informatica 10

From the below screenshot, we added four columns.

Export Data from SQL Server to Flat File in Informatica 11

You can use the Properties tab to define the Date time Format or to change the default format. Once you added the required columns, Click OK to close the Edit tables window

Export Data from SQL Server to Flat File in Informatica 12

Now you can that the target table had required column names.

Export Data from SQL Server to Flat File in Informatica 13

Step 3: Create Mapping to export data from SQL to Flat File in Informatica

To create a new mapping, Please navigate to Mappings menu in Menu Bar, and select the Create.. option.

Export Data from SQL Server to Flat File in Informatica 14

It opens the Mapping Name window to write a unique name for this mapping. Let me write m_export_SQL_to_text and click the OK button.

Export Data from SQL Server to Flat File in Informatica 15

Drag and drop the Employe source definitions from Sources folder to the mapping designer. Once you drag the source, the Power Center designer automatically creates the Source Qualifier Transformation for you.

Export Data from SQL Server to Flat File in Informatica 16

Next, Drag and drop the target definition from Targets folder to the mapping designer. Next, connect the Informatica Export Data from SQL Server to Flat File source qualifier with the target definition using the Autolink.. option.

Let us Save and Validate the mapping by going to Mapping and select the Validate option.

Export Data from SQL Server to Flat File in Informatica 17

Step 4: Create a Workflow to move data from SQL Server to Text File in Informatica

After we finish creating the Informatica Export Data from SQL Server to Flat File Mapping, we have to create the workflow for it. Power Center Workflow manager provides two approaches to create a workflow.

In this Informatica Export Data from SQL Server to Flat File example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

Export Data from SQL Server to Flat File in Informatica 18

It opens the Create Workflow window. Please provide the unique name (wf_export_SQL_to_text) and leave the default settings.

Export Data from SQL Server to Flat File in Informatica 19

Once we created the workflow, our next step is to create a session task for our mapping.

Step 4(a): Create Session to move data from SQL to Text File

There are two types of sessions in Informatica:

For this Informatica Export Data from SQL Server to Flat File example, we created a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and choose the Create option.

Export Data from SQL Server to Flat File in Informatica 20

Please provide a unique name for this session. Here, we are naming it as s_export_sql_to_text

Export Data from SQL Server to Flat File in Informatica 21

Once you click on the Create button, a new window called Mappings will open. Here you have to select the mapping that you want to associate with this session i.e., m_export_sql_to_text.

Export Data from SQL Server to Flat File in Informatica 22

Please link the Start Task and the Session Task.

Export Data from SQL Server to Flat File in Informatica 23

Double click on the Session task will open the Edit Tasks window. Within Properties Tab, we have configured $Source connection value. This property will store the relational source information in the $Source variable.

Export Data from SQL Server to Flat File in Informatica 24

So, click on the Arrow we marked above, and select the SQL Tutorial as the source information.

Export Data from SQL Server to Flat File in Informatica 25

You can configure the Sessions Log properties, Error properties in Config Object

Export Data from SQL Server to Flat File in Informatica 26

Within the mappings tab, we have to set the Source and Target Connections. First, let us configure the source connections by clicking on the SQ_Employe source present in the Sources folder.

With in the Connections, click on the Arrow button beside the Relational type, and Use Connection variable that we created earlier, i.e., $Source

Export Data from SQL Server to Flat File in Informatica 27

Now, we have to configure the Target Connection. So, let us set the target connection by clicking on the Employetable present in the Targets folder.

Export Data from SQL Server to Flat File in Informatica 28

If your requirement is Merging the data, use this Merge Type property. For now, we are leaving it to the No Merge option. I suggest you explore the remaining options.

Export Data from SQL Server to Flat File in Informatica 29

Export Data from SQL Server to Flat File in Informatica 30

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow. Now, Let me start the Workflow by selecting the Start Workflow option in Workflows Menu.

Export Data from SQL Server to Flat File in Informatica 31

Once you select the Start Workflow option, the Workflow monitor will open to monitor the workflow. From the below screenshot, see our Informatica Export Data from SQL Server to Flat File workflow is executed without any errors.

Export Data from SQL Server to Flat File in Informatica 32

Let us open the default target location of the Informatica to check whether we successfully created a text file, and transfer the data from a source or not.

Export Data from SQL Server to Flat File in Informatica 33

You can see the data inside the employee table text file.

Export Data from SQL Server to Flat File in Informatica 34

Let me change the file location from Default Informatica destination to D folder, and also changing the name as employeetable. Next, Save and start the Workflow

Export Data from SQL Server to Flat File in Informatica 35

Now you can see the employeetable.txt in D drive

Export Data from SQL Server to Flat File in Informatica 36

 

 

 

 

 

Load Data From Text File to SQL Server in Informatica

In this article, we will show you how to Load Data From Text File to SQL Server in Informatica with an example. For this Informatica Load Data From Text File to SQL Server example, we are going to use the below show text file data (Employee table)

Load Data From Text File to SQL Server in Informatica 1

and the Destination table is File Destination. As you can see, it is an Empty table

Load Data From Text File to SQL Server in Informatica 2

Load Data From Text File to SQL Server in Informatica

Before we start configuring the Informatica to Load Data from Text File (or Flat File) to SQL Server. First, connect to Informatica repository service by providing the Informatica Admin Console Username and password you specified while installing the Informatica Server.

Step 1: Create a Source Definition for Informatica Load Data From Text File to SQL Server

Please navigate to Source Analyzer to define your Sources. As we said before, we are using the Employee table present in the local File System as our source definitions. So, Please navigate to the Source menu and select the Import from File..

Load Data From Text File to SQL Server in Informatica 3

Once you select the Import from File.. option, a new window called Open Flat File will open. Please select the Employee.txt file from your local file system and click the Open button. I suggest you refer Flat File Source in Informatica article to under the following steps.

Load Data From Text File to SQL Server in Informatica 4

Once you click the Open button, a new pop up window called Flat File Import Wizard will open.

Load Data From Text File to SQL Server in Informatica 5

Step 2:

Load Data From Text File to SQL Server in Informatica 6

Here, we can edit the Column Name, Data type, Length or Precision, Scale, and Width. In general, we don’t do that, but if you want, you can do it.

Load Data From Text File to SQL Server in Informatica 7

From the below screenshot, you can see our newly created Flat File source in Informatica

Load Data From Text File to SQL Server in Informatica 8

Step 2: Create Target Definition for Informatica Load Data From Text File to SQL Server

Please navigate to Target Designer to define the Target. In this example, we are using the existing SQL table as our target definition. So, go to the Targets menu and select the Import from Database.. option.

Load Data From Text File to SQL Server in Informatica 9

Please select the ODBC connection that connects the Informatica with the SQLTest Database. To create a new one, please refer to the Informatica ODBC Connection article.

From the below screenshot, you can observe that we are selecting the File Destination table from our SQLTest database. You can refer to Create Target table using Source Definition to understand the target definition

Load Data From Text File to SQL Server in Informatica 10

Now you can see the target table with required column names.

Load Data From Text File to SQL Server in Informatica 11

Step 3: Create Mapping to Load Data From Text File to SQL Server

To create a new mapping for Informatica Load Data From Text File to SQL Server, Please navigate to Mappings menu in Menu Bar, and select the Create.. option.

Load Data From Text File to SQL Server in Informatica 12

It opens the Mapping Name window to write a unique name for this mapping (m_load_text_to_SQL) and click OK button.

Load Data From Text File to SQL Server in Informatica 13

Drag and drop the Employee source definitions from the Flat File Sources folder to the mapping designer. Once you drag the source, the PowerCenter designer automatically creates the Source Qualifier Transformation for you.

Load Data From Text File to SQL Server in Informatica 14

Next, Drag and drop the target definition (File Destination) from Targets folder to the mapping designer. Next, connect the source qualifier with the target definition using the Autolink.. option.

Before we close the Mapping, Let us Save, and Validate the mapping by going to Mapping Menu bar, and select the Validate option.

Load Data From Text File to SQL Server in Informatica 15

Step 4: Create Workflow to Load Data From Text File to SQL Server

After we finish creating the Mapping, we have to create the workflow for it. Power Center Workflow manager provides two approaches to create a workflow.

In this example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

Load Data From Text File to SQL Server in Informatica 16

It opens the Create Workflow window. Please provide the unique name (wf_load_text_to_SQL) and leave the default settings.

Load Data From Text File to SQL Server in Informatica 17

Once we created the Informatica Load Data From Text File to SQL Server workflow, our next step is to create a session task for our mapping.

Step 4(a): Create Session to Load Data From Flat File to SQL Server in Informatica

There are two types of sessions in Informatica:

For this Informatica Load Data From Flat File to SQL Server example, we created a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and select the Create option as shown below.

Load Data From Text File to SQL Server in Informatica 18

Please provide a unique name for this session (s_load_text_to_sql)

Load Data From Text File to SQL Server in Informatica 19

Once you click on the Create button, a new window called Mappings will open. Here select the mapping that you want to associate with this session, i.e., m_load_text_to_sql.

Load Data From Text File to SQL Server in Informatica 20

Please link the Start Task and the Session Task.

Load Data From Text File to SQL Server in Informatica 21

Double click on the Session task will open the Edit Tasks window. Within Properties Tab, we have configured the $Target connection value. This property stores the relational source information in the $Target variable.

Load Data From Text File to SQL Server in Informatica 22

So, click on the Arrow we marked above, and select the SQL Test as the target information.

Load Data From Text File to SQL Server in Informatica 23

Within the mappings tab, we have to configure the Source and Target Connections. First, let us set the Target connection by clicking on the FileDestination.

Within the Connections, click on the Arrow button beside the Relational type, and Use Connection variable that we created before, i.e., $Target

Load Data From Text File to SQL Server in Informatica 24

You can change the Target Load type from Bulk to Normal as per your requirement.

Load Data From Text File to SQL Server in Informatica 25

Now, we have to configure the Source Connection. Please click on the SQ_Employee present in the Sources folder.

Load Data From Text File to SQL Server in Informatica 26

Load Data From Text File to SQL Server in Informatica 27

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow. Now, Let me start the Workflow by choosing the Start Workflow option in Workflows Menu.

Load Data From Text File to SQL Server in Informatica 28

Once you select the Start Workflow option, Workflow monitor opened to monitor the workflow. From the below screenshot, our Informatica Load Data From Text File to SQL Server workflow executed without any errors.

Load Data From Text File to SQL Server in Informatica 29

Let us open the SQL Server to check whether we successfully transfer the data from a source or not.

Load Data From Text File to SQL Server in Informatica 30

 

 

Load Multiple Text Files into SQL Server in Informatica

In this article, we will show you how to Load Multiple Text Files into SQL Server in Informatica with example. For this Informatica Load Multiple Text Files into SQL Server example, we are going to use Four Text files present in our local file system, i.e., D:\FILE SYSTEM TASK FOLDER\

Load Multiple Text Files into SQL Server in Informatica 1

Data present in the Employee1.txt file

Load Multiple Text Files into SQL Server in Informatica 2

Data present in the Employee2.txt file

Load Multiple Text Files into SQL Server in Informatica 3

Below screenshot will show you the data in the Employee3.txt file

Load Multiple Text Files into SQL Server in Informatica 4

Data present in the Employee4.txt file

Load Multiple Text Files into SQL Server in Informatica 5

Data in the Employee file

Load Multiple Text Files into SQL Server in Informatica 37

And the Destination table is Multiple File Destination. As you see, it is an Empty table

Load Multiple Text Files into SQL Server in Informatica 6

Load Data From Multiple Text Files to SQL Server in Informatica

Before we start configuring the Informatica to Load Data from multiple Text Files (or Flat Files) to SQL Server. First, connect to Informatica repository service by providing the Informatica Admin Console Username and password you specified while installing the Informatica Server.

Step 1: Create an Informatica Source Definition to Load Multiple Text Files into SQL Server

Once you connected successfully, Please navigate to Source Analyzer to define your Sources. To load data from multiple files, we have to provide the source definition that is common for all the text files. For this, we are using Employee1, but you can try any one (Employee2, 3, or 4).

To load the data present in our local file system, Please navigate to Source menu and select the Import from File.. option

Load Multiple Text Files into SQL Server in Informatica 7

Once you choose the Import from File.. option, a new window called Open Flat File opened. Please select the Employee1.txt file from your local file system. I suggest you refer Flat File Source in Informatica article to know the following steps.

Load Multiple Text Files into SQL Server in Informatica 8

Once you click the Ok button, a new pop up window called Flat File Import Wizard will open. Here, our text separated by comma delimiter, so we are selecting the Delimited option. Next, we check marked the Import filed names from the first line option. Because our text file contains column names as the first line

Load Multiple Text Files into SQL Server in Informatica 9

Under the Delimiter section, we are selecting Comma. And under the Text Qualifier section, we are selecting No quotes because our flat-file doesn’t have any quotes.

Load Multiple Text Files into SQL Server in Informatica 10

Here, we can edit the Column Name, Data type, Length or Precision, Scale, and Width. Please change the length, width, or scale as per your requirements.

Load Multiple Text Files into SQL Server in Informatica 11

From the below screenshot, you can see our newly created Flat File source in Informatica

Load Multiple Text Files into SQL Server in Informatica 12

Step 2: Create an Informatica Target Definition to Load Multiple Text Files into SQL Server

Please navigate to Target Designer to define the Target. In this example, we use the existing SQL table as our target definition. So, go to the Targets menu and select the Import from Database.. option.

Load Multiple Text Files into SQL Server in Informatica 13

Please select the ODBC connection that will connect the Informatica with the SQL Test Database. To create a new one, please refer to the Informatica ODBC Connection article.

From the below screenshot, we are selecting the Multiple File Destination table from our SQL Test database. You can refer to Create Target table using Source Definition.

Load Multiple Text Files into SQL Server in Informatica 14

Now you can see the target table with required column names.

Load Multiple Text Files into SQL Server in Informatica 15

Step 3: Create Mapping to Load Data From Multiple Text Files to SQL Server

To create a new mapping, Please navigate to Mappings menu in Menu Bar, and select the Create.. option.

Load Multiple Text Files into SQL Server in Informatica 16

It opens the Mapping Name window to write a unique name for this mapping. Let me write m_load_multifiles_to_sql and click OK button.

Load Multiple Text Files into SQL Server in Informatica 17

Drag and drop the Employee1 source definitions from Sources folder to the mapping designer. Once you drag the source, the Power Center designer automatically creates the Source Qualifier Transformation for you.

Load Multiple Text Files into SQL Server in Informatica 18

Next, Drag and drop the target definition (Multiple File Destination) from Targets folder to the mapping designer. Next, connect the source qualifier with the target definition using the Autolink.. option.

Before we close the Mapping, Let us Save, and Validate the mapping by going to Mapping Menu bar, and select the Validate option.

Load Multiple Text Files into SQL Server in Informatica 19

Step 4: Create Workflow to Load Data From Multiple Text Files to SQL Server

After we finish creating the Informatica Load Multiple Text Files into SQL Server Mapping, we have to create the workflow for it. Power Center Workflow manager provides two approaches to create workflow.

In this example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

Load Multiple Text Files into SQL Server in Informatica 20

It opens the Create Workflow window. Please provide the unique name (wf_load_multifiles_to_SQL) and leave the default settings.

Load Multiple Text Files into SQL Server in Informatica 21

Once we created the workflow, our next step is to create a session task for our mapping.

Step 4(a): Create Session to Load Data From Multiple Text Files to SQL Server

There are two types of sessions in informatica:

For this Informatica Load Multiple Text Files into SQL Server example, we are creating a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and select the Create option

Load Multiple Text Files into SQL Server in Informatica 22

Please provide a unique name (s_load_multifiles_to_sql) for this session.

Load Multiple Text Files into SQL Server in Informatica 23

Once you click on the Create button, a new window called Mappings will open. Here you have to select the mapping (i.e., m_load_multifiles_to_sql) that you want to associate with this session.

Load Multiple Text Files into SQL Server in Informatica 24

Please link the Start Task and the Session Task.

Load Multiple Text Files into SQL Server in Informatica 25

Double click on the Session task will open the Edit Tasks window. Within Properties Tab, we have configured the $Target connection value. This property stores the relational source information in the $Target variable.

Load Multiple Text Files into SQL Server in Informatica 26

So, click on the Arrow we marked above, and select the SQL Test as the target information.

Load Multiple Text Files into SQL Server in Informatica 27

Within the mappings tab, we have to configure the Source and Target Connections. First, let us set the Target connection by clicking on the FileDestination.

Within the Connections, click on the Arrow button beside the Relational type, and Use Connection variable that we created in our previous step, i.e., $Target

Load Multiple Text Files into SQL Server in Informatica 28

You can change the Target Load type from Bulk to Normal as per your requirement.

Load Multiple Text Files into SQL Server in Informatica 29

Now, we have to configure the Source Connection. Please click on the SQ_Employee1 present in the Sources folder. Please change the Source Filetype option from Direct to Indirect.

Load Multiple Text Files into SQL Server in Informatica 30

Load Multiple Text Files into SQL Server in Informatica 31

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow. Now, Let me start the Workflow by selecting the Start Workflow option in Workflows Menu.

Load Multiple Text Files into SQL Server in Informatica 32

Let us open the SQL Server Management Studio to check whether we successfully transfer the data from multiple text files or not.

Load Multiple Text Files into SQL Server in Informatica 33

Let me alter the Employee text file. It means, Informatica has to load data from Employee1.txt file, and Employee4.txt file

Load Multiple Text Files into SQL Server in Informatica 34

Please checkmark the Truncate Target Table option to delete the existing records from the Target table, i.e., Multiple File Destination. I suggest you to refer SQL Truncate to understand the concept.

Load Multiple Text Files into SQL Server in Informatica 35

Let us open the SQL Server Management Studio. As you can see from the below screenshot, Informatica loaded the data from Employee 1 and Employee 4 text files.

Load Multiple Text Files into SQL Server in Informatica 36