WiX ODBC 数据源错误。 ODBC 错误 8:无效的关键字-值对
我试图在使用 Windows Installer XML (WiX) 在 Windows 7 计算机上安装的安装过程中为 SQL Server 2008 R2 数据库建立数据源名称 (DSN)。我正在对话框窗口中设置两个集成安全条件,但我的问题是其中一个失败。 Windows 身份验证(INTEGRATEDSECURITY =“是”)工作正常且没有错误。 SQL Server 身份验证(INTEGRATEDSECURITY =“否”)在 SQL 用户名和密码上失败。至少人们相信是这样,因为 SQL Server 名称和数据库名称对于 Windows 身份验证来说就像一个魅力。我希望有人能找到一个解决方案,不需要我使用第三方扩展来使用 SQL Server 身份验证创建与数据库的正确 ODBC DSN 连接。
在失败路径上安装期间出现的错误如下:
“配置 ODBC 数据源时出错:DB_Test,ODBC 错误 8:无效的关键字-值对。验证文件 DB_Test 是否存在并且您可以访问它。”
ODBC数据源如下:
<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>
自定义对话框UI如下:
<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>
感谢大家协助我解决这个问题!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有同样的错误...通过一些研究,我认为这与由于安全原因 SQL 连接不支持 uid 和 pwd 有关。这让我认为 ODBC 连接需要通过自定义操作而不是 ODBCDataSource 来设置...
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...