If you want to receive data from a SQL table directly into a field in InfoPath then do the following. First, create a new library in your SharePoint site using the template ”Data connections library”:
Name the library like "SQLConnections" or something. (Choose not to display it in your QuickLaunch if you want to hide this library):
Open InfoPath and open the form in which you want your new data connection (or you can open a blank form and do the same thing there). Click on "Tools" and "Data connections" and create a new SQL database connection:
Select the database:
Finish and your data connection is added. Now, click on "Convert" button:
Enter the URL of your SharePoint site and the Data Connection library that you created before. Remove the "Forms/Allitems.aspx" at the end of the URL and replace that with a filename instead, for example "myconnection.udcx":
When you finish, you'll see that the "Convert" button is grey. Press Close to return to the form: