I created a UDCX file
for data connection using SQL Server authentication in InfoPath form of SharePoint 2010. After that, I created a secure storeId which has credentials stored for SQL authentication. Removed the username and password from the UDC file and added it back to data connection library .
The udc file contents
<?xml version="1.0" encoding="UTF-8"?>
<?MicrosoftWindowsSharePointServices ContentTypeID="0x000000000000000000000000000"?>
<udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="http://schemas.microsoft.com/office/infopath/2006/udc">
<udc:Name>namevalue</udc:Name>
<udc:Description>Format: UDC V2; Connection Type: Database; Purpose: ReadOnly; Generated by Microsoft InfoPath 2010 on 2016-08-20 at 19:30:42 by MyId.</udc:Description>
<udc:Type MajorVersion="2" MinorVersion="0" Type="Database">
<udc:SubType MajorVersion="0" MinorVersion="0" Type=""/>
</udc:Type>
<udc:ConnectionInfo Purpose="ReadOnly" AltDataSource="">
<udc:WsdlUrl/>
<udc:SelectCommand>
<udc:ListId/>
<udc:WebUrl/>
<udc:ConnectionString>Provider=SQLOLEDB.1;Persist Security Info=True;Initial Catalog=databasecatalogname;Data Source=fqdnservername;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=machinename;Use Encryption for Data=False;Tag with column collation when possible=False</udc:ConnectionString>
<udc:ServiceUrl UseFormsServiceProxy="false"/>
<udc:SoapAction/>
<udc:Query>select "field1","field2" from "dbo"."tablename" as "tablename"</udc:Query>
</udc:SelectCommand>
<udc:UpdateCommand>
<udc:ServiceUrl UseFormsServiceProxy="false"/>
<udc:SoapAction/>
<udc:Submit/>
<udc:FileName>Specify a filename or formula</udc:FileName>
<udc:FolderName AllowOverwrite=""/>
</udc:UpdateCommand>
<udc:Authentication><udc:SSO AppId='securestoreid' CredentialType='Sql' /></udc:Authentication>
</udc:ConnectionInfo>
I am getting following error
Data adapter failed during OnLoad: Current configuration settings prohibit embedding username and password in the database connection string.