I've been doing a lot of work around Governance of SharePoint within our organisation and have been hitting brick walls with regards to InfoPath. Especially with regards to Environmental differences when using Forms with Data Sources.
I've found lots of articles pushing Data Connection Libraries with .udcx files which is fine to a point but this is the best one. With this being the best explanation of the ins and outs of the actual file. This one starts to explain the environment thing but fails to deliver on the issues outlined below. Plenty more on my Diigo collection.
Where it works
Where this works well is when you have a udcx file that points to a SharePoint list e.g. http://dev/test/dcl/test.udcx would have an element pointing to http://dev/test/lists/ContractList/.
You can deploy this file to the same location on each environment and select that the link in the InfoPath form be relative to a particular server name e.g. having the http://dev/test/dcl/test.udcx and http://staging/test/dcl/test.udcx will work with the same InfoPath form.
You would have to modify each .udcx file to point to it's appropriate SharePoint List e.g. http://staging/test/dcl/test.udcx would have point to http://staging/test/lists/ContractList/. This is far easier than having to open up InfoPath Client to modify this and also can be programmatically written and uploaded to the Data Connection Library as part of a Solution package (post with code coming!).
This is useful so that you don't have to store multiple versions of one form for each environment, or tinker with the form Data Connections when deploying it...especially if you want Server Administrators doing this.
Where it isn't cool
Note this is not relative to where the InfoPath form is being hosted from! So if you have another Web created on your server where you want it to use it's own .udcx files e.g. the udcx files are configured to point at SharePoint Lists within itself such as http://dev/test/subweb/dcl/test.udcx you would need to modify the Data Connection in the InfoPath form itself. So it's not that flexible!
A good scenario for this is if you have a form where you want to reuse it's functionality but have each instance posting to a different SharePoint List without having to have different InfoPath form versions for each instance.
The Central Administration maintained Data Connection files is another place to put these, but again, if you wanted different SharePoint List Connections in each, you'd need separate instances of each and therefore you'd have to modify the InfoPath forms to point to the correct instance!
What would be nice
It would be great if the InfoPath form was intelligent enough to know which SharePoint List fired off a "New Form" action and then post it back to itself and relative to this List look for a Data Connection Library. But we can all dream! This guy has the same dream! Maybe the Data Connections can be set in Code Behind on the InfoPath forms, but again that's more headache and you start thinking why we don't just use ASPX forms to do this stuff!