Thanks for a great hint, Chris! It also pointed me to my mistake I was
trying to figure out for a day...
But, as for the proposed strategy - it doesn't work for me.

I've followed your instructions below to trifles. Here is what I get in
my log:

...
MSI (s) (40:38) [12:46:12:187]: Doing action: SetDBUserMaster
Action 12:46:12: SetDBUserMaster. 
Action start 12:46:12: SetDBUserMaster.
MSI (s) (40:38) [12:46:12:187]: PROPERTY CHANGE: Adding SqlMasterDB
property. Its value is 'SqlMasterDBAuth'.
Action ended 12:46:12: SetDBUserMaster. Return value 1.
MSI (s) (40:38) [12:46:12:187]: Doing action: ProcessComponents
...

This says the custom action run and the property was set. 
My scripts reference SqlMasterDB in SqlDb attribute. User attribute is
never put to SqlString elements:

<sql:SqlString Id="AttachCore" ExecuteOnInstall="yes"
SqlDb="SqlMasterDB" SQL="CREATE DATABASE
[\[][INSTANCENAME]Something_Core[\]] ON ( FILENAME =
N'[DB_FOLDER]$(var.CoreFileName)' ), ( FILENAME =
N'[DB_FOLDER]$(var.CoreFileLogName)' ) FOR ATTACH"/>

But later in the log file I can see the following:

...
MSI (s) (40:38) [12:46:12:890]: Doing action: InstallSqlData
Action 12:46:12: InstallSqlData. Configuring SQL Server
Action start 12:46:12: InstallSqlData.
MSI (s) (40:AC) [12:46:12:921]: Invoking remote custom action. DLL:
C:\WINDOWS\Installer\MSI21D.tmp, Entrypoint: InstallSqlData
MSI (s) (40!00) [12:46:12:937]: PROPERTY CHANGE: Adding
ExecuteSqlStrings property. Its value is
'SqlMasterDB?.\SQLEXPRESS??master?-2147483648?1???AttachCore?1?CREATE
DATABASE [YSWix01Something_Core] ON ( FILENAME =
N'D:\default\Databases\Something.Core.MDF' ), ( FILENAME =
N'D:\default\Databases\Something.Core.ldf' ) FOR ATTACH'.
MSI (s) (40!00) [12:46:12:953]: Doing action: ExecuteSqlStrings
Action 12:46:12: ExecuteSqlStrings. Executing SQL Strings
Action start 12:46:12: ExecuteSqlStrings.
1: Executing SQL Strings 
Action ended 12:46:12: ExecuteSqlStrings. Return value 1.
Action ended 12:46:12: InstallSqlData. Return value 1.
...

And, as you can see, the value passed to the deferred action is still
SqlMasterDB, not SqlMasterDBAuth.
Hence, I can see my DBs being attached in context of my Windows user,
but not SQL sa user.

Please, point me on my mistake here.
Thank you very much!

-- Yan

-----Original Message-----
From: Christopher Karper [mailto:christopher.kar...@gmail.com] 
Sent: Tuesday, December 16, 2008 8:41 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Distinguish between SQL integrated security
andnormal authentication

This is a little crazy, so I'll try to be as clear as possible...

Here's the pertinent section of my DB installer:

        <!-- ******************** Database Creation Entities
******************** -->
        <util:User Id="SqlCreateUser" Name="[SQLCREATEUSER]"
Password="[SQLCREATEPASSWORD]" />

        <sql:SqlDatabase Id="SqlMasterDB" Database="master"
Server="[SQLSERVER]" />
        <sql:SqlDatabase Id="SqlMasterDBAuth" Database="master"
Server="[SQLSERVER]" User="SqlCreateUser" />
        <!-- ******************** /Database Creation Entities
******************** -->

        <CustomAction Id="SetDBUserMaster" Property="SqlMasterDB"
Value="SqlMasterDBAuth" />
        <InstallExecuteSequence>
            <Custom Action="SetDBUserMaster"
Before="ProcessComponents">USESQLAUTH=1</Custom>
        </InstallExecuteSequence>


First, I create a User entity using the possibly supplied properties.
Then
I create 2 SqlDatabase items.
SqlMasterDB is the one I intend to use with my scripts, and is set up to
use
integrated security.
I also create a SqlMasterDBAuth which connects to the same server, but
uses
SqlAuthentication.

I schedule a property replacement CA to assign the Sql Auth DB object
over
the integrated security one if the USESQLAUTH Property is set.

This allows me to write all my components pointing to SqlMasterDB, and
it
will contain the correct connection info when the time comes.

If this isn't clear enough, let me know.  I'll be happy to cover it
more.

Chris

On Tue, Dec 16, 2008 at 8:12 AM, tgoffice <tgoff...@web.de> wrote:

>
> Ok, how can I implement it in a better way ...
>
> Thanks in advanced!
> tom
>
>
> cemiles wrote:
> >
> > Oh, I think I know what you're saying now.  And I believe the answer
is
> > you
> > do need 2 components in order to do so, or so I've read and done.
> >
> > On Mon, Dec 15, 2008 at 9:10 AM, tgoffice <tgoff...@web.de> wrote:
> >
> >>
> >> Sorry, no this is a missunterstanding (my bad english
> >>  ... :confused:)
> >>
> >> How can I differ between a SqlDatabase with and without integrated
> >> security,
> >> withoud creating to components with nearly the same content (only
the
> >> User
> >> differs but I have to duplicate all sql scripts)
> >>
> >>
> >>
> >>
> >> cemiles wrote:
> >> >
> >> > Sorry, and that tag is incorrect for the RBG.
> >> >
> >> > Should read <RadioButtonGroup Property="ISINTEGRATEDSECURITY">
> >> >
> >> >
> >> >
> >> > cemiles wrote:
> >> >>
> >> >> You could set up a radiobuttongroup control and tie that
condition
> >> >> property to it.
> >> >>
> >> >> So, something like this would be the short version for 1
property
> >> >> DATABASEUSER:
> >> >>
> >> >>   <Fragment>
> >> >>     <UI>
> >> >>       <Dialog Id="DBUserServerDlg" Width="370" Height="270"
> >> >> Title="!(loc.DBUserServerDlg_Title)">
> >> >>         <Control Id="RadioButtons" Type="RadioButtonGroup"
X="35"
> >> Y="85"
> >> >> Width="301" Height="66" Property="ISINTEGRATEDSECURITY">
> >> >>           <RadioButtonGroup Property="SQLTYPE">
> >> >>             <RadioButton
Text="!(loc.DBUserServerDlg_DBRadio1_Text)"
> >> >> X="0" Y="0" Width="300" Height="15" Value="1" />
> >> >>           </RadioButtonGroup>
> >> >>         </Control>
> >> >>         <Control Type="Edit" Width="172" Height="15" X="155"
Y="151"
> >> >> Id="DatabaseUserText" Property="DATABASEUSER">
> >> >>         <Condition
Action="show">ISINTEGRATEDSECURITY=0</Condition>
> >> >>         <Condition
Action="hide>ISINTEGRATEDSECURITY=1</Condition>
> >> >>         </Control>
> >> >>         <Control Type="Text" Width="112" Height="10" X="35"
Y="154"
> >> >> Id="DatabaseUser" Transparent="yes" NoPrefix="yes"
> >> >> Text="!(loc.DBUserServerDlg_DatabaseUser)">
> >> >>           <Condition
Action="show">ISINTEGRATEDSECURITY=0</Condition>
> >> >>           <Condition
Action="hide">ISINTEGRATEDSECURITY=1</Condition>
> >> >>         </Control>
> >> >>       </Dialog>
> >> >>     </UI>
> >> >>   </Fragment>
> >> >>
> >> >> Is this what you're looking for or am I mis-reading?
> >> >>
> >> >>
> >> >> tgoffice wrote:
> >> >>>
> >> >>> Hello,
> >> >>>
> >> >>> what is the most elegant (common way) to distingwhish between
sql
> >> >>> connection with integrated security and with user
name/password.
> >> >>>
> >> >>> I have a GUI to enter user database server, instance name, user
> name,
> >> >>> password ... to connect to an database. If user name and
password
> are
> >> >>> not provided integrated securits should be used.
> >> >>> I have a property "ISINTEGRATEDSECURITY" to differ between the
> >> >>> installation of two different components.
> >> >>> (very error pron and with duplicate code, very ugly)
> >> >>>
> >> >>> WIX code to differ between both authentications
> >> >>>
> >> >>> <util:User Id="DatabaseUser" Name="[DATABASEUSER]"
> >> >>> Password="[DATABASEPASSWORD]"/>
> >> >>>
> >> >>> <Component Directory="SERVERDIR" Id="comp_db_create" DiskId="1"
> >> >>> KeyPath="yes" Guid="3B3DCDB3-BCA8-4F71-8269-AF2F36EFF80A">
> >> >>>     <Condition>ISINTEGRATEDSECURITY = 0</Condition>
> >> >>>     <sql:SqlDatabase Id="ProcessEngineDatabase"
> >> ConfirmOverwrite="yes"
> >> >>> CreateOnInstall="yes" Server="[DATABASESERVER]"
> >> >>> Instance="[DATABASEINSTANCE]" Database="[DBNAME]"
> User="DatabaseUser"
> >> >>> ContinueOnError="no">
> >> >>>     <sql:SqlScript Id="Upper.S3.DataObjects.drop"
BinaryKey="SQL1"
> >> >>> ExecuteOnInstall="yes" ContinueOnError="no" Sequence="10"/>
> >> >>> ...
> >> >>>
> >> >>> <Component Directory="SERVERDIR" Id="comp_db_create" DiskId="1"
> >> >>> KeyPath="yes" Guid="3B3DCDB3-BCA8-4F71-8269-AF2F36EFF80A">
> >> >>>     <Condition>ISINTEGRATEDSECURITY = 1</Condition>
> >> >>>     <sql:SqlDatabase Id="ProcessEngineDatabase"
> >> ConfirmOverwrite="yes"
> >> >>> CreateOnInstall="yes" Server="[DATABASESERVER]"
> >> >>> Instance="[DATABASEINSTANCE]" Database="[DBNAME]"
> >> ContinueOnError="no">
> >> >>>     <sql:SqlScript Id="Upper.S3.DataObjects.drop"
BinaryKey="SQL1"
> >> >>> ExecuteOnInstall="yes" ContinueOnError="no" Sequence="10"/>
> >> >>> ...
> >> >>>
> >> >>> What is the best way to accomplish this issue.
> >> >>>
> >> >>> Thank's
> >> >>> TG
> >> >>>
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
>
http://n2.nabble.com/Distinguish-between-SQL-integrated-security-and-nor
mal-authentication-tp1642658p1658344.html
> >>  Sent from the wix-users mailing list archive at Nabble.com.
> >>
> >>
> >>
> >>
>
------------------------------------------------------------------------
------
> >> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> >> Nevada.
> >> The future of the web can't happen without you.  Join us at MIX09
to
> help
> >> pave the way to the Next Web now. Learn more and register at
> >>
> >>
>
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.
com/
> >> _______________________________________________
> >> WiX-users mailing list
> >> WiX-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >>
> >
> >
> >
> > --
> > Chad E. Miles
> > Software Engineer, Development
> > Interactive Intelligence, Inc.
> > chad.mi...@inin.com
> > 317.715.8280 Office/Fax
> >
>
------------------------------------------------------------------------
------
> > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> > Nevada.
> > The future of the web can't happen without you.  Join us at MIX09 to
help
> > pave the way to the Next Web now. Learn more and register at
> >
>
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.
com/
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> >
>
> --
> View this message in context:
>
http://n2.nabble.com/Distinguish-between-SQL-integrated-security-and-nor
mal-authentication-tp1642658p1662667.html
> Sent from the wix-users mailing list archive at Nabble.com.
>
>
>
>
------------------------------------------------------------------------
------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to
help
> pave the way to the Next Web now. Learn more and register at
>
>
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.
com/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------
------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you.  Join us at MIX09 to
help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.
com/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to