Re: [WiX-users] Attach a database
Me, too, Tim. Although, I have to say that I'm probably starting to suffer Stockholm Syndrome with WiX and MSBuild... I don't know about "beautiful" but more like "elegant" in the engineering sense of the word. Welcome to the voodoo. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of silence8212 Sent: Friday, August 15, 2008 02:45 To: [email protected] Subject: Re: [WiX-users] Attach a database Hi David, thanks for your advise. Now I'm dropping database instead of detaching and it works according to my ideas. I'm newbie in Wix, so I'm only discovering magics of this beautiful technology ;) David Reed (SQL) wrote: > > I'm a little confused on the desired outcome. You're detaching the > database on uninstall, instead of dropping it (which would delete the > files)... You're also trying to drop the database elsewhere while the > connection context is mapped to the database you're trying to drop, which > won't work (you need to USE another database before you try to drop it). > > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of silence8212 > Sent: Thursday, August 14, 2008 10:05 > To: [email protected] > Subject: Re: [WiX-users] Attach a database > > > Hi Tim, > > thanks for a code example, I allowed to use this example in my scenario > and > it works perfect, but it doesn't delete database files and directory when > uninstall. I want to delete database files after uninstall. This is code: > > ... > > Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3"> > > /> > GenericAll="yes" /> > > > KeyPath="yes"/> > ExecuteOnUninstall="yes" > Id="DropUserId" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE]" > ContinueOnError="no"/> > ExecuteOnUninstall="yes" > Id="DetachDb" SQL="sp_detach_db [\[][DBNAME][\]], true, false" > ContinueOnError="yes"/> > RollbackOnInstall="yes" > Id="RollbackDb" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE];DROP > DATABASE [\[][DBNAME][\]]" > ContinueOnError="no"/> > ExecuteOnInstall="yes" > Id="AttachDb" SQL="CREATE DATABASE [\[][DBNAME][\]] ON > (FILENAME=N'[#DemoMDF]') FOR ATTACH" > ContinueOnError="no"/> > ExecuteOnInstall="yes" > Id="CreateUserId" SQL="IF NOT EXISTS ( SELECT * FROM > sys.server_principals WHERE name = > N'[USERIDVALUE]' ) CREATE LOGIN > [USERIDVALUE] WITH PASSWORD='[PWDVALUE]', > DEFAULT_DATABASE=[DBNAME], > CHECK_POLICY=OFF;USE [DBNAME];IF EXISTS(SELECT > name FROM sys.sysusers > WHERE name=N'[USERIDVALUE]')DROP USER > [USERIDVALUE];CREATE USER > [USERIDVALUE];EXEC sp_addrolemember db_owner, > [USERIDVALUE];" > ContinueOnError="no"/> > > > ... > > > > > ... > > When I uninstall, everything(files, directories) is deleted, but this one > directory(Data) and database files(demo.mdf/ldf) are not deleted. In the > msi > uninstall log are no information, which can help me find out, why this > files > are not deleted. > > thanks > > > > > > Tim Fisher wrote: >> >> Yes, you're right it does. Ok, your suggestions worked. Now my SQL >> scripts run correctly. Thank you! >> >> One thing to note is that if I tried to use ExecuteOnInstall in the >> same element with a RollbackOnUninstall, then it doesn't get executed >> at all (undocumented). >> >> Anyway I have a new problem, during uninstall. Is there a way to >> install these files normally, but leave them alone on uninstall? >> (Since they may now contain user data.) >> >> Here's my code now: >> >> >> > Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3"> >> > KeyPath="yes" >> /> >> > Source="Baseline_log.ldf" /> >> > ExecuteOnUninstall="yes" >> Id="DropUserId" SQ
Re: [WiX-users] Attach a database
Hi David, thanks for your advise. Now I'm dropping database instead of detaching and it works according to my ideas. I'm newbie in Wix, so I'm only discovering magics of this beautiful technology ;) David Reed (SQL) wrote: > > I'm a little confused on the desired outcome. You're detaching the > database on uninstall, instead of dropping it (which would delete the > files)... You're also trying to drop the database elsewhere while the > connection context is mapped to the database you're trying to drop, which > won't work (you need to USE another database before you try to drop it). > > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of silence8212 > Sent: Thursday, August 14, 2008 10:05 > To: [email protected] > Subject: Re: [WiX-users] Attach a database > > > Hi Tim, > > thanks for a code example, I allowed to use this example in my scenario > and > it works perfect, but it doesn't delete database files and directory when > uninstall. I want to delete database files after uninstall. This is code: > > ... > > Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3"> > > /> > GenericAll="yes" /> > > > KeyPath="yes"/> > ExecuteOnUninstall="yes" > Id="DropUserId" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE]" > ContinueOnError="no"/> > ExecuteOnUninstall="yes" > Id="DetachDb" SQL="sp_detach_db [\[][DBNAME][\]], true, false" > ContinueOnError="yes"/> > RollbackOnInstall="yes" > Id="RollbackDb" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE];DROP > DATABASE [\[][DBNAME][\]]" > ContinueOnError="no"/> > ExecuteOnInstall="yes" > Id="AttachDb" SQL="CREATE DATABASE [\[][DBNAME][\]] ON > (FILENAME=N'[#DemoMDF]') FOR ATTACH" > ContinueOnError="no"/> > ExecuteOnInstall="yes" > Id="CreateUserId" SQL="IF NOT EXISTS ( SELECT * FROM > sys.server_principals WHERE name = > N'[USERIDVALUE]' ) CREATE LOGIN > [USERIDVALUE] WITH PASSWORD='[PWDVALUE]', > DEFAULT_DATABASE=[DBNAME], > CHECK_POLICY=OFF;USE [DBNAME];IF EXISTS(SELECT > name FROM sys.sysusers > WHERE name=N'[USERIDVALUE]')DROP USER > [USERIDVALUE];CREATE USER > [USERIDVALUE];EXEC sp_addrolemember db_owner, > [USERIDVALUE];" > ContinueOnError="no"/> > > > ... > > > > > ... > > When I uninstall, everything(files, directories) is deleted, but this one > directory(Data) and database files(demo.mdf/ldf) are not deleted. In the > msi > uninstall log are no information, which can help me find out, why this > files > are not deleted. > > thanks > > > > > > Tim Fisher wrote: >> >> Yes, you're right it does. Ok, your suggestions worked. Now my SQL >> scripts run correctly. Thank you! >> >> One thing to note is that if I tried to use ExecuteOnInstall in the >> same element with a RollbackOnUninstall, then it doesn't get executed >> at all (undocumented). >> >> Anyway I have a new problem, during uninstall. Is there a way to >> install these files normally, but leave them alone on uninstall? >> (Since they may now contain user data.) >> >> Here's my code now: >> >> >> > Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3"> >> > KeyPath="yes" >> /> >> > Source="Baseline_log.ldf" /> >> > ExecuteOnUninstall="yes" >> Id="DropUserId" SQL="USE [\[][DBNAME][\]];DROP LOGIN >> [USERIDVALUE];DROP USER [USERIDVALUE]" ContinueOnError ="yes" /> >> > ExecuteOnUninstall="yes" >> Id="DetachDb" SQL="sp_detach_db [\[][DBNAME][\]], true, false" >> ContinueOnError="yes" /> >> > RollbackOnInstall="yes" >> Id="RollbackDb" SQL="USE [\[][DBNAME][\]];DROP LOGIN
Re: [WiX-users] Attach a database
I'm a little confused on the desired outcome. You're detaching the database on uninstall, instead of dropping it (which would delete the files)... You're also trying to drop the database elsewhere while the connection context is mapped to the database you're trying to drop, which won't work (you need to USE another database before you try to drop it). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of silence8212 Sent: Thursday, August 14, 2008 10:05 To: [email protected] Subject: Re: [WiX-users] Attach a database Hi Tim, thanks for a code example, I allowed to use this example in my scenario and it works perfect, but it doesn't delete database files and directory when uninstall. I want to delete database files after uninstall. This is code: ... ... ... When I uninstall, everything(files, directories) is deleted, but this one directory(Data) and database files(demo.mdf/ldf) are not deleted. In the msi uninstall log are no information, which can help me find out, why this files are not deleted. thanks Tim Fisher wrote: > > Yes, you're right it does. Ok, your suggestions worked. Now my SQL > scripts run correctly. Thank you! > > One thing to note is that if I tried to use ExecuteOnInstall in the > same element with a RollbackOnUninstall, then it doesn't get executed > at all (undocumented). > > Anyway I have a new problem, during uninstall. Is there a way to > install these files normally, but leave them alone on uninstall? > (Since they may now contain user data.) > > Here's my code now: > > >Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3"> >KeyPath="yes" > /> >Source="Baseline_log.ldf" /> >Id="DropUserId" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE]" ContinueOnError ="yes" /> >Id="DetachDb" SQL="sp_detach_db [\[][DBNAME][\]], true, false" > ContinueOnError="yes" /> >Id="RollbackDb" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE];DROP DATABASE [\[][DBNAME][\]]" > ContinueOnError="yes" /> >Id="AttachDb" SQL="CREATE DATABASE [\[][DBNAME][\]] ON > (FILENAME=N'[#MDF]') FOR ATTACH" ContinueOnError="yes" /> >Id="CreateUserId" SQL="IF NOT EXISTS ( SELECT * FROM > sys.server_principals WHERE name = N'[USERIDVALUE]' ) CREATE LOGIN > [USERIDVALUE] WITH PASSWORD='[PWDVALUE]', DEFAULT_DATABASE=[DBNAME], > CHECK_POLICY=OFF;USE [DBNAME];IF EXISTS(SELECT name FROM sys.sysusers > WHERE name=N'[USERIDVALUE]')DROP USER [USERIDVALUE];CREATE USER > [USERIDVALUE];EXEC sp_addrolemember db_owner, [USERIDVALUE];" > ContinueOnError="yes" /> > > > > Tim > > On Fri, Jun 13, 2008 at 2:55 PM, Rob Mensching > <[EMAIL PROTECTED]> wrote: >> We're working on getting the WiX v3 documentation up there. However, >> every download of the WiX toolset includes an up to date (as much as we >> have it) version of the WiX.chm. That should contain all the >> information... >> > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > ___ > WiX-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wix-users > > -- View this message in context: http://n2.nabble.com/Attach-a-database-tp712370p724565.html Sent from the wix-users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
Hi Tim, thanks for a code example, I allowed to use this example in my scenario and it works perfect, but it doesn't delete database files and directory when uninstall. I want to delete database files after uninstall. This is code: ... ... ... When I uninstall, everything(files, directories) is deleted, but this one directory(Data) and database files(demo.mdf/ldf) are not deleted. In the msi uninstall log are no information, which can help me find out, why this files are not deleted. thanks Tim Fisher wrote: > > Yes, you're right it does. Ok, your suggestions worked. Now my SQL > scripts run correctly. Thank you! > > One thing to note is that if I tried to use ExecuteOnInstall in the > same element with a RollbackOnUninstall, then it doesn't get executed > at all (undocumented). > > Anyway I have a new problem, during uninstall. Is there a way to > install these files normally, but leave them alone on uninstall? > (Since they may now contain user data.) > > Here's my code now: > > >Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3"> >KeyPath="yes" > /> >Source="Baseline_log.ldf" /> >Id="DropUserId" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE]" ContinueOnError ="yes" /> >Id="DetachDb" SQL="sp_detach_db [\[][DBNAME][\]], true, false" > ContinueOnError="yes" /> >Id="RollbackDb" SQL="USE [\[][DBNAME][\]];DROP LOGIN > [USERIDVALUE];DROP USER [USERIDVALUE];DROP DATABASE [\[][DBNAME][\]]" > ContinueOnError="yes" /> >Id="AttachDb" SQL="CREATE DATABASE [\[][DBNAME][\]] ON > (FILENAME=N'[#MDF]') FOR ATTACH" ContinueOnError="yes" /> >Id="CreateUserId" SQL="IF NOT EXISTS ( SELECT * FROM > sys.server_principals WHERE name = N'[USERIDVALUE]' ) CREATE LOGIN > [USERIDVALUE] WITH PASSWORD='[PWDVALUE]', DEFAULT_DATABASE=[DBNAME], > CHECK_POLICY=OFF;USE [DBNAME];IF EXISTS(SELECT name FROM sys.sysusers > WHERE name=N'[USERIDVALUE]')DROP USER [USERIDVALUE];CREATE USER > [USERIDVALUE];EXEC sp_addrolemember db_owner, [USERIDVALUE];" > ContinueOnError="yes" /> > > > > Tim > > On Fri, Jun 13, 2008 at 2:55 PM, Rob Mensching > <[EMAIL PROTECTED]> wrote: >> We're working on getting the WiX v3 documentation up there. However, >> every download of the WiX toolset includes an up to date (as much as we >> have it) version of the WiX.chm. That should contain all the >> information... >> > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > ___ > WiX-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wix-users > > -- View this message in context: http://n2.nabble.com/Attach-a-database-tp712370p724565.html Sent from the wix-users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
1. Uhh, that first issue is a bug. Either the code is wrong or the documentation is wrong. Can you open a bug with information about specifically what doesn't work with ExecuteOnInstall/RollbackOnUninstall? 2. Make the Component permanent. You may have to your Component smaller (generally a good thing) to get the exact behavior you want. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher Sent: Saturday, June 14, 2008 12:42 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Attach a database Yes, you're right it does. Ok, your suggestions worked. Now my SQL scripts run correctly. Thank you! One thing to note is that if I tried to use ExecuteOnInstall in the same element with a RollbackOnUninstall, then it doesn't get executed at all (undocumented). Anyway I have a new problem, during uninstall. Is there a way to install these files normally, but leave them alone on uninstall? (Since they may now contain user data.) Here's my code now: Tim On Fri, Jun 13, 2008 at 2:55 PM, Rob Mensching <[EMAIL PROTECTED]> wrote: > We're working on getting the WiX v3 documentation up there. However, every > download of the WiX toolset includes an up to date (as much as we have it) > version of the WiX.chm. That should contain all the information... > - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
Yes, you're right it does. Ok, your suggestions worked. Now my SQL scripts run correctly. Thank you! One thing to note is that if I tried to use ExecuteOnInstall in the same element with a RollbackOnUninstall, then it doesn't get executed at all (undocumented). Anyway I have a new problem, during uninstall. Is there a way to install these files normally, but leave them alone on uninstall? (Since they may now contain user data.) Here's my code now: Tim On Fri, Jun 13, 2008 at 2:55 PM, Rob Mensching <[EMAIL PROTECTED]> wrote: > We're working on getting the WiX v3 documentation up there. However, every > download of the WiX toolset includes an up to date (as much as we have it) > version of the WiX.chm. That should contain all the information... > - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
We're working on getting the WiX v3 documentation up there. However, every download of the WiX toolset includes an up to date (as much as we have it) version of the WiX.chm. That should contain all the information... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher Sent: Friday, June 13, 2008 08:25 To: [email protected] Subject: Re: [WiX-users] Attach a database Turns out the sourceforge wix2 documentation regarding the SqlDatabase element is still valid for wix3's version of SqlDatabase. http://wix.sourceforge.net/manual-wix2/wix_xsd_sqldatabase.htm Wow, if we could just have one place for all the documentation, it would really help a lot with the confusion and frustration of trying to learn wix. Tim On Thu, Jun 12, 2008 at 6:18 PM, Tim Fisher <[EMAIL PROTECTED]> wrote: > I created a new wxs file with a Fragment in it, then I moved my SqlDatabase > element over into the Fragment element like this: > > http://schemas.microsoft.com/wix/2006/wi"; > xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension";> > > Database="master"> > RollbackOnInstall="yes" SQL="DROP DATABASE [\[][DBNAME][\]]" Sequence="1" /> > SQL="CREATE DATABASE [\[][DBNAME][\]] ON (FILENAME=N'[#MDF]') FOR ATTACH" > Sequence="2" /> > Sequence="3" /> > > > > > Now I have two new questions. > > First, how do I reference this SqlDatabase element over in the Component > element that uses it over in the main wxs file? > > Second, when I try to compile I get, "SqlString element cannot be specified > unless the element has a component as an ancestor." How did you get your > SqlStrings to work using a Fragment? > > Tim > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Rob Mensching > Sent: Friday, June 06, 2008 12:46 PM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Attach a database > > If you place the SqlDatabase element under a Component element that will > attempt to create the database. My SqlDatabase element is a direct child of > one of my Fragment elements. It is a little confusing but that causes the > SqlDatabase element to search for an existing database. Unfortunate naming > a long time ago that hasn't been straightened out. > > > - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
Turns out the sourceforge wix2 documentation regarding the SqlDatabase element is still valid for wix3's version of SqlDatabase. http://wix.sourceforge.net/manual-wix2/wix_xsd_sqldatabase.htm Wow, if we could just have one place for all the documentation, it would really help a lot with the confusion and frustration of trying to learn wix. Tim On Thu, Jun 12, 2008 at 6:18 PM, Tim Fisher <[EMAIL PROTECTED]> wrote: > I created a new wxs file with a Fragment in it, then I moved my SqlDatabase > element over into the Fragment element like this: > > http://schemas.microsoft.com/wix/2006/wi"; > xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension";> > > Database="master"> > RollbackOnInstall="yes" SQL="DROP DATABASE [\[][DBNAME][\]]" Sequence="1" /> > SQL="CREATE DATABASE [\[][DBNAME][\]] ON (FILENAME=N'[#MDF]') FOR ATTACH" > Sequence="2" /> > Sequence="3" /> > > > > > Now I have two new questions. > > First, how do I reference this SqlDatabase element over in the Component > element that uses it over in the main wxs file? > > Second, when I try to compile I get, "SqlString element cannot be specified > unless the element has a component as an ancestor." How did you get your > SqlStrings to work using a Fragment? > > Tim > > > -----Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Rob Mensching > Sent: Friday, June 06, 2008 12:46 PM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Attach a database > > If you place the SqlDatabase element under a Component element that will > attempt to create the database. My SqlDatabase element is a direct child of > one of my Fragment elements. It is a little confusing but that causes the > SqlDatabase element to search for an existing database. Unfortunate naming > a long time ago that hasn't been straightened out. > > > - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
I created a new wxs file with a Fragment in it, then I moved my SqlDatabase element over into the Fragment element like this: http://schemas.microsoft.com/wix/2006/wi"; xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension";> Now I have two new questions. First, how do I reference this SqlDatabase element over in the Component element that uses it over in the main wxs file? Second, when I try to compile I get, "SqlString element cannot be specified unless the element has a component as an ancestor." How did you get your SqlStrings to work using a Fragment? Tim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rob Mensching Sent: Friday, June 06, 2008 12:46 PM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Attach a database If you place the SqlDatabase element under a Component element that will attempt to create the database. My SqlDatabase element is a direct child of one of my Fragment elements. It is a little confusing but that causes the SqlDatabase element to search for an existing database. Unfortunate naming a long time ago that hasn't been straightened out. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
If you place the SqlDatabase element under a Component element that will attempt to create the database. My SqlDatabase element is a direct child of one of my Fragment elements. It is a little confusing but that causes the SqlDatabase element to search for an existing database. Unfortunate naming a long time ago that hasn't been straightened out. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher Sent: Friday, June 06, 2008 06:09 To: WiX-users Subject: Re: [WiX-users] Attach a database When I do it that way, I get a compile-time "Error 1 When nested under a component, the sql:SqlDatabase element must have one of the following attributes specified: CreateOnInstall, CreateOnUninstall, DropOnInstall or DropOnUninstall." Is the v3 WixSqlExtension ready, or should I be using something else to do this? Tim On Thu, Jun 5, 2008 at 8:45 PM, Rob Mensching <[EMAIL PROTECTED]> wrote: > At the top of the Fragment: > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher > Sent: Thursday, June 05, 2008 16:53 > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Attach a database > > Can you show the definition for your LocalMasterDB element? > > Tim > > > On Thu, Jun 5, 2008 at 1:35 PM, Rob Mensching > <[EMAIL PROTECTED]> wrote: >> I have something that looks a lot like this (in WiX v2): >> >> >>> LongName="$(var.LongDBName)_data.mdf" >> Source="SourceDir\$(var.LongDBName)Baseline.mdf" /> >>> LongName="$(var.LongDBName)_log.ldf" >> Source="SourceDir\$(var.LongDBName)Baseline.ldf" /> >> >>> Directory="$(var.PublicLongDBName)_FOLDER" Name="$(var.ShortPrefix)*.*" >> LongName="$(var.LongDBName)*.*" On="uninstall" /> >> >>> SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="1" >> SQL="EXEC >> $(var.LongDBName).dbo.sp_addrolemember 'db_owner', '$(var.ServiceAccount)'" >> /> >>> ExecuteOnUninstall="yes" Sequence="2" ContinueOnError="yes" >> SQL="EXEC >> $(var.LongDBName).dbo.sp_droprolemember 'db_owner', '$(var.ServiceAccount)'" >> /> >> >>> SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="3" >> SQL="EXEC master.dbo.sp_grantlogin >> '$(var.ServiceAccount)'" /> >>> SqlDb="LocalMasterDB" ExecuteOnUninstall="yes" Sequence="4" >> ContinueOnError="yes" >> SQL="EXEC master.dbo.sp_droplogin >> '$(var.ServiceAccount)'" /> >> >>> RollbackOnUninstall="yes" ContinueOnError="yes" Sequence="5" >> SQL="CREATE DATABASE $(var.LongDBName) ON >> (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> >>> ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="6" >> SQL="ALTER DATABASE $(var.LongDBName) SET >> OFFLINE WITH ROLLBACK IMMEDIATE" /> >>> ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="7" >> SQL="EXEC sp_detach_db >> @dbname='$(var.LongDBName)', @skipchecks='true'" /> >> >>> ExecuteOnInstall="yes" Sequence="8" >> SQL="CREATE DATABASE $(var.LongDBName) ON >> (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> >>> RollbackOnInstall="yes" ContinueOnError="yes" Sequence="9" >> SQL="EXEC sp_detach_db >> @dbname='$(var.LongDBName)', @skipchecks='true'" /> >> >>> SqlDb="LocalMasterDB" RollbackOnInstall="yes" Sequence="10" >> ContinueOnError="yes" >> SQL="EXEC master.dbo.sp_droplogin &
Re: [WiX-users] Attach a database
When I do it that way, I get a compile-time "Error 1 When nested under a component, the sql:SqlDatabase element must have one of the following attributes specified: CreateOnInstall, CreateOnUninstall, DropOnInstall or DropOnUninstall." Is the v3 WixSqlExtension ready, or should I be using something else to do this? Tim On Thu, Jun 5, 2008 at 8:45 PM, Rob Mensching <[EMAIL PROTECTED]> wrote: > At the top of the Fragment: > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher > Sent: Thursday, June 05, 2008 16:53 > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Attach a database > > Can you show the definition for your LocalMasterDB element? > > Tim > > > On Thu, Jun 5, 2008 at 1:35 PM, Rob Mensching > <[EMAIL PROTECTED]> wrote: >> I have something that looks a lot like this (in WiX v2): >> >> >>> LongName="$(var.LongDBName)_data.mdf" >> Source="SourceDir\$(var.LongDBName)Baseline.mdf" /> >>> LongName="$(var.LongDBName)_log.ldf" >> Source="SourceDir\$(var.LongDBName)Baseline.ldf" /> >> >>> Directory="$(var.PublicLongDBName)_FOLDER" Name="$(var.ShortPrefix)*.*" >> LongName="$(var.LongDBName)*.*" On="uninstall" /> >> >>> SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="1" >> SQL="EXEC >> $(var.LongDBName).dbo.sp_addrolemember 'db_owner', '$(var.ServiceAccount)'" >> /> >>> ExecuteOnUninstall="yes" Sequence="2" ContinueOnError="yes" >> SQL="EXEC >> $(var.LongDBName).dbo.sp_droprolemember 'db_owner', '$(var.ServiceAccount)'" >> /> >> >>> SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="3" >> SQL="EXEC master.dbo.sp_grantlogin >> '$(var.ServiceAccount)'" /> >>> SqlDb="LocalMasterDB" ExecuteOnUninstall="yes" Sequence="4" >> ContinueOnError="yes" >> SQL="EXEC master.dbo.sp_droplogin >> '$(var.ServiceAccount)'" /> >> >>> RollbackOnUninstall="yes" ContinueOnError="yes" Sequence="5" >> SQL="CREATE DATABASE $(var.LongDBName) ON >> (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> >>> ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="6" >> SQL="ALTER DATABASE $(var.LongDBName) SET >> OFFLINE WITH ROLLBACK IMMEDIATE" /> >>> ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="7" >> SQL="EXEC sp_detach_db >> @dbname='$(var.LongDBName)', @skipchecks='true'" /> >> >>> ExecuteOnInstall="yes" Sequence="8" >> SQL="CREATE DATABASE $(var.LongDBName) ON >> (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> >>> RollbackOnInstall="yes" ContinueOnError="yes" Sequence="9" >> SQL="EXEC sp_detach_db >> @dbname='$(var.LongDBName)', @skipchecks='true'" /> >> >>> SqlDb="LocalMasterDB" RollbackOnInstall="yes" Sequence="10" >> ContinueOnError="yes" >> SQL="EXEC master.dbo.sp_droplogin >> '$(var.ServiceAccount)'" /> >>> SqlDb="LocalMasterDB" ExecuteOnInstall="yes" Sequence="11" >> SQL="IF NOT EXISTS (SELECT * FROM >> sys.server_principals WHERE name = N'$(var.ServiceAccount)') EXEC >> master.dbo.sp_grantlogin '$(var.ServiceAccount)'; USE $(var.LongDBName); IF >> EXISTS(SELECT name FROM sys.sysusers WHERE name=N'$(var.ServiceAccount)') >> EXEC $(var.
Re: [WiX-users] Attach a database
At the top of the Fragment: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher Sent: Thursday, June 05, 2008 16:53 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Attach a database Can you show the definition for your LocalMasterDB element? Tim On Thu, Jun 5, 2008 at 1:35 PM, Rob Mensching <[EMAIL PROTECTED]> wrote: > I have something that looks a lot like this (in WiX v2): > > > LongName="$(var.LongDBName)_data.mdf" > Source="SourceDir\$(var.LongDBName)Baseline.mdf" /> > LongName="$(var.LongDBName)_log.ldf" > Source="SourceDir\$(var.LongDBName)Baseline.ldf" /> > > Directory="$(var.PublicLongDBName)_FOLDER" Name="$(var.ShortPrefix)*.*" > LongName="$(var.LongDBName)*.*" On="uninstall" /> > > SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="1" > SQL="EXEC > $(var.LongDBName).dbo.sp_addrolemember 'db_owner', '$(var.ServiceAccount)'" /> > ExecuteOnUninstall="yes" Sequence="2" ContinueOnError="yes" > SQL="EXEC > $(var.LongDBName).dbo.sp_droprolemember 'db_owner', '$(var.ServiceAccount)'" > /> > > SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="3" > SQL="EXEC master.dbo.sp_grantlogin > '$(var.ServiceAccount)'" /> > ExecuteOnUninstall="yes" Sequence="4" ContinueOnError="yes" > SQL="EXEC master.dbo.sp_droplogin > '$(var.ServiceAccount)'" /> > > RollbackOnUninstall="yes" ContinueOnError="yes" Sequence="5" > SQL="CREATE DATABASE $(var.LongDBName) ON > (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> > ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="6" > SQL="ALTER DATABASE $(var.LongDBName) SET > OFFLINE WITH ROLLBACK IMMEDIATE" /> > ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="7" > SQL="EXEC sp_detach_db > @dbname='$(var.LongDBName)', @skipchecks='true'" /> > > ExecuteOnInstall="yes" Sequence="8" > SQL="CREATE DATABASE $(var.LongDBName) ON > (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> > RollbackOnInstall="yes" ContinueOnError="yes" Sequence="9" > SQL="EXEC sp_detach_db > @dbname='$(var.LongDBName)', @skipchecks='true'" /> > > SqlDb="LocalMasterDB" RollbackOnInstall="yes" Sequence="10" > ContinueOnError="yes" > SQL="EXEC master.dbo.sp_droplogin > '$(var.ServiceAccount)'" /> > SqlDb="LocalMasterDB" ExecuteOnInstall="yes" Sequence="11" > SQL="IF NOT EXISTS (SELECT * FROM > sys.server_principals WHERE name = N'$(var.ServiceAccount)') EXEC > master.dbo.sp_grantlogin '$(var.ServiceAccount)'; USE $(var.LongDBName); IF > EXISTS(SELECT name FROM sys.sysusers WHERE name=N'$(var.ServiceAccount)') > EXEC $(var.LongDBName).dbo.sp_dropuser '$(var.ServiceAccount)'; EXEC > $(var.LongDBName).dbo.sp_grantdbaccess '$(var.ServiceAccount)'; IF > EXISTS(SELECT name FROM sys.sysusers WHERE name=N'ms') EXEC > $(var.LongDBName).dbo.sp_dropuser 'ms'; EXEC > $(var.LongDBName).dbo.sp_grantdbaccess 'ms'" /> > > SqlDb="LocalMasterDB" RollbackOnInstall="yes" Sequence="12" > ContinueOnError="yes" > SQL="EXEC > $(var.LongDBName).dbo.sp_droprolemember 'db_owner', '$(var.ServiceAccount)'" > /> > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher > Sent:
Re: [WiX-users] Attach a database
Can you show the definition for your LocalMasterDB element? Tim On Thu, Jun 5, 2008 at 1:35 PM, Rob Mensching <[EMAIL PROTECTED]> wrote: > I have something that looks a lot like this (in WiX v2): > > > LongName="$(var.LongDBName)_data.mdf" > Source="SourceDir\$(var.LongDBName)Baseline.mdf" /> > LongName="$(var.LongDBName)_log.ldf" > Source="SourceDir\$(var.LongDBName)Baseline.ldf" /> > > Directory="$(var.PublicLongDBName)_FOLDER" Name="$(var.ShortPrefix)*.*" > LongName="$(var.LongDBName)*.*" On="uninstall" /> > > SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="1" > SQL="EXEC > $(var.LongDBName).dbo.sp_addrolemember 'db_owner', '$(var.ServiceAccount)'" /> > ExecuteOnUninstall="yes" Sequence="2" ContinueOnError="yes" > SQL="EXEC > $(var.LongDBName).dbo.sp_droprolemember 'db_owner', '$(var.ServiceAccount)'" > /> > > SqlDb="LocalMasterDB" RollbackOnUninstall="yes" Sequence="3" > SQL="EXEC master.dbo.sp_grantlogin > '$(var.ServiceAccount)'" /> > ExecuteOnUninstall="yes" Sequence="4" ContinueOnError="yes" > SQL="EXEC master.dbo.sp_droplogin > '$(var.ServiceAccount)'" /> > > RollbackOnUninstall="yes" ContinueOnError="yes" Sequence="5" > SQL="CREATE DATABASE $(var.LongDBName) ON > (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> > ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="6" > SQL="ALTER DATABASE $(var.LongDBName) SET > OFFLINE WITH ROLLBACK IMMEDIATE" /> > ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="7" > SQL="EXEC sp_detach_db > @dbname='$(var.LongDBName)', @skipchecks='true'" /> > > ExecuteOnInstall="yes" Sequence="8" > SQL="CREATE DATABASE $(var.LongDBName) ON > (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> > RollbackOnInstall="yes" ContinueOnError="yes" Sequence="9" > SQL="EXEC sp_detach_db > @dbname='$(var.LongDBName)', @skipchecks='true'" /> > > SqlDb="LocalMasterDB" RollbackOnInstall="yes" Sequence="10" > ContinueOnError="yes" > SQL="EXEC master.dbo.sp_droplogin > '$(var.ServiceAccount)'" /> > SqlDb="LocalMasterDB" ExecuteOnInstall="yes" Sequence="11" > SQL="IF NOT EXISTS (SELECT * FROM > sys.server_principals WHERE name = N'$(var.ServiceAccount)') EXEC > master.dbo.sp_grantlogin '$(var.ServiceAccount)'; USE $(var.LongDBName); IF > EXISTS(SELECT name FROM sys.sysusers WHERE name=N'$(var.ServiceAccount)') > EXEC $(var.LongDBName).dbo.sp_dropuser '$(var.ServiceAccount)'; EXEC > $(var.LongDBName).dbo.sp_grantdbaccess '$(var.ServiceAccount)'; IF > EXISTS(SELECT name FROM sys.sysusers WHERE name=N'ms') EXEC > $(var.LongDBName).dbo.sp_dropuser 'ms'; EXEC > $(var.LongDBName).dbo.sp_grantdbaccess 'ms'" /> > > SqlDb="LocalMasterDB" RollbackOnInstall="yes" Sequence="12" > ContinueOnError="yes" > SQL="EXEC > $(var.LongDBName).dbo.sp_droprolemember 'db_owner', '$(var.ServiceAccount)'" > /> > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher > Sent: Thursday, June 05, 2008 08:58 > To: [email protected] > Subject: [WiX-users] Attach a database > > I'm using WiX 3.0.4130.0 and I'm trying to figure out how to attach a > database. I'm getting a runtime error using this method: > > > /> > > Database="[DBNAME]" DropOnUninstall="yes"> > SQL="CREATE > DATABASE [\[][DBNAME][\]] ON (FILENAME=N'[#MDF]') FOR ATTACH" /> > > > > The log file looks good, but the error looks like it's trying to > access the database before it's been created or something. > > What am I doing wrong? > > Tim > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > ___ > WiX-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wix-users > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > __
Re: [WiX-users] Attach a database
Ok here's what I have now. It installs correctly, but the uninstall fails with 0x80004005 failed to connect to database. Tim - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Attach a database
I have something that looks a lot like this (in WiX v2): -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher Sent: Thursday, June 05, 2008 08:58 To: [email protected] Subject: [WiX-users] Attach a database I'm using WiX 3.0.4130.0 and I'm trying to figure out how to attach a database. I'm getting a runtime error using this method: The log file looks good, but the error looks like it's trying to access the database before it's been created or something. What am I doing wrong? Tim - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users

