I am trying to establish a Data Source Name (DSN) to a SQL Server 2008 R2 database during the install process using Windows Installer XML (WiX) to install on a Windows 7 machine. I am setting two integrated security conditions from within a dialog window and my issue is one fails. The Windows Authentication (INTEGRATEDSECURITY = “Yes”) is working correctly and without error. The SQL Server Authentication (INTEGRATEDSECURITY = “No”) is failing on the SQL username and password. At least it is believed so, since the SQL Server Name and the Database Name work like a charm with Windows Authentication. I am hoping that someone will have a solution that does not require me to use third party extensions to create the proper ODBC DSN connection to the database using SQL Server Authentication.
The error during install on the failed path reads:
“Error configuring ODBC data source: DB_Test, ODBC error 8: Invalided keyword-value pairs. Verify that the file DB_Test exists and that you can access it.”
The ODBC DataSource is as follows:
<Component Id="DB_Test_DSN_SSPI" Guid="{******}">
<Condition>INTEGRATEDSECURITY = "Yes"</Condition>
<ODBCDataSource Id="DB_Test_DSN_SSPI" Name="DB_Test $(var.DisplayVersion)" DriverName="SQL Server" KeyPath="yes" Registration="machine">
<Property Id="Server" Value="[SERVERNAME]" />
<Property Id="Database" Value="[DATABASENAME]" />
<Property Id="Description" Value="DB_Test" />
<Property Id="Trusted_Connection" Value="[INTEGRATEDSECURITY]" />
</ODBCDataSource>
</Component>
<Component Id="DB_Test_DSN_SQLAUTH" Guid="{*****}">
<Condition>INTEGRATEDSECURITY = "No"</Condition>
<ODBCDataSource Id="DB_Test_DSNSQLAUTH" Name="DB_Test $(var.DisplayVersion)" DriverName="SQL Server" KeyPath="yes" Registration="machine">
<Property Id="Server" Value="[SERVERNAME]" />
<Property Id="Database" Value="[DATABASENAME]" />
<Property Id="Description" Value="DB_Test" />
<Property Id="Trusted_Connection" Value="[INTEGRATEDSECURITY]" />
<Property Id="uid" Value="[DATABASEUSER]" />
<Property Id="pwd" Value="[DATABASEPASS]" />
</ODBCDataSource>
</Component>
The Custom dialog UI is as follows:
<Dialog Id="DialogDatabase" Width="370" Height="270" Title="$(var.ProductName) Setup">
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Specify Database" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Specify the location of the DB_Test" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="ServerNameLabel" Type="Text" X="32" Y="54" Width="290" Height="13" NoPrefix="yes" Text="SQL Server (Hostname\Instance,Port):" />
<Control Id="ServerNameEdit" Type="Edit" X="32" Y="66" Width="290" Height="18" Property="SERVERNAME" />
<Control Id="DatabaseNameLabel" Type="Text" X="32" Y="88" Width="290" Height="13" NoPrefix="yes" Text="Database name:" />
<Control Id="DatabaseNameEdit" Type="Edit" X="32" Y="100" Width="290" Height="18" Property="DATABASENAME" />
<Control Id="INTEGRATEDSECURITY" Type="RadioButtonGroup" X="32" Y="124" Width="290" Height="28" HasBorder="yes" Property="INTEGRATEDSECURITY" Text="Select Authentication Method">
<RadioButtonGroup Property="INTEGRATEDSECURITY">
<RadioButton Value="Yes" X="8" Y="12" Width="130" Height="10" Text="Windows Authentication" />
<RadioButton Value="No" X="150" Y="12" Width="130" Height="10" Text="SQL Server Authentication" />
</RadioButtonGroup>
</Control>
<Control Id="DatabaseUserLabel" Type="Text" Hidden="yes" X="32" Y="158" Width="290" Height="13" NoPrefix="yes" Text="SQL Username:">
<Condition Action="show"><![CDATA[INTEGRATEDSECURITY = "No"]]></Condition>
<Condition Action="hide"><![CDATA[INTEGRATEDSECURITY = "Yes"]]></Condition>
</Control>
<Control Id="DatabaseUserEdit" Type="Edit" Hidden="yes" X="32" Y="170" Width="290" Height="18" Property="DATABASEUSER">
<Condition Action="show"><![CDATA[INTEGRATEDSECURITY = "No"]]></Condition>
<Condition Action="hide"><![CDATA[INTEGRATEDSECURITY = "Yes"]]></Condition>
</Control>
<Control Id="DatabasePassLabel" Type="Text" Hidden="yes" X="32" Y="192" Width="290" Height="13" NoPrefix="yes" Text="SQL Password:">
<Condition Action="show"><![CDATA[INTEGRATEDSECURITY = "No"]]></Condition>
<Condition Action="hide"><![CDATA[INTEGRATEDSECURITY = "Yes"]]></Condition>
</Control>
<Control Id="DatabasePassEdit" Type="Edit" Hidden="yes" X="32" Y="204" Width="290" Height="18" Property="DATABASEPASS" Password="yes">
<Condition Action="show"><![CDATA[INTEGRATEDSECURITY = "No"]]></Condition>
<Condition Action="hide"><![CDATA[INTEGRATEDSECURITY = "Yes"]]></Condition>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
<!--<Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>-->
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
<!--<Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>-->
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
Thank you everyone for assisting me with this question!
I have the same error... Through some research, i think it has to do with uid and pwd being unsupported for SQL connections due to security. This makes me think that the ODBC connection needs to be set up through a custom action rather than the ODBCDataSource...