We can set our InfoPath forms to receive SQL data. In order to do that we need have a
A SharePoint library to hold our data connection files. Our list will use this data connection to retrieve rows from SQL DB. Its fairly straightforward to create a library in SP site.
Go to your SharePoint site -> Libraries->Create->Data Connection Library, give your library a name. (My Data Connections)
Now we have a ‘My Data Connections’ library to hold all the connections. It is important to have it at the root site level so that we can use it for all our sub-sites forms too if needed.
Now in our InfoPath form, we need to create a SQL Data Connection from the Data->Data Connections->Add.
Create a new connection to: Receive data
Select the source of your data to Database(Microsoft SQL Server only)
Select Database ->New Source
Enter the server name
Choose the database, table you want to use in your InfoPath form.
Save the Data Connection File and Finish.
We have our new SQL data connection which can be used to populate any control we want within the InfoPath form.