Here I am going to explain how to get the data from sql table into your infopath form. Also check out some posts on:
1. Open your infopath form and click on DATA tab from ribbon.
2. Then click on Data connection and then click on Add.
3. Now from the dialog box check on "Receive Data".
4. Now from the next dialog box choose "Database".
5. Now click on select Database and click on "Connect to New Data source" and open.
6. From the data connection wizard choose "Microsoft SQL Server", Now it will ask for you sql server name.
7. Give the server name->next and choose windows authentication or sql authenication as per your requirement.
8. In the next dialog box select your database and then choose your desired table and click on next.
9. In the next dialog box you can change the name or you can keep that name.
10. In the next dialog box,check on your desired columns and then click on next->next.
11. In this dialog box you can give the name data connection or you can keep the name provided by system and uncheck "automatically retrieve data when form is opened".
12. Finally click on finish and your data connection is created.