Hi Michael,

Steps forward:
- I have created a reasonably robust workaround using an elevated
Vbscript custom action to create the database and detect whether
Windows/SQL authentication should be used. This completely removes my
dependency on the Wix SqlDatabase element and works reliably for local
or remote database creation.

Steps backward:
- Using my separate Wix project .wxs file previously attached I am no
longer able to generate a 'Login failed' error message at the SQL Server
end. I.e. No login attempt is logged in the SQL Server log -or- in the
Windows Application event log. In fact all I see is the 'failed to
create database' error in the MSI log. What has changed? When first
encountering this problem I upgraded from Wix 3.0 to 3.5 to see if the
latest version fixed the problem. I need to investigate this further if
time is available - someone else must have seen something like this
unless I'm doing something silly...

In response to your points I can confirm that:
- The 'Create Database' action works via SQL Management Studio, C++
native app using ADO and SQLCMD. Each of the client applications were
run from a remote machine connecting to the SQL Server and used the same
'sa' user credentials as supplied to the Wix MSI.
- I'm not setting any MDF or log file locations in the MSI, i.e. I'm
allowing SQL Server to use its default data paths. It also appears to
not be related to anything silly like disk space errors, firewall, etc.

Before I took a step backward, the SQL server log showed:

Login failed for user 'sa'. Reason: Failed to open the explicitly
specified database.
Error: 18456, Severity: 14, State: 38.

For now, I've chosen to run with the custom Vbscript action as my
solution. It doesn't seem ideal, but I have tried to make it as robust
as Vbscript will allow. It will also additionally log progress to the
MSI log using 'Session.Message' which is at least a plus point. 

Thank you for your help anyway, I confess to having learned some more
about error messages and 'State' values as a result!

Regards,
Rob.


-----Original Message-----
From: Michael Osmond <mosm...@baytech.com.au>
To: General discussion for Windows Installer XML toolset.
        <wix-users@lists.sourceforge.net>

Hi Rob

My experience Error 0x80004005 will be an access denied type error.
Check the SQL Management Logs for the SQL instance to see what the error
is.   Possible issues:

* It could be logon (description below on how to diagnose a logon error)
* It could be be privilege.
* It could be you are setting a path to the MDF / LDF files that the SQL
Service does not have access to.

To check the 2nd and 3rd errors, run the equivalent create database
command from a remote tool, using the appropriate logon and see what
error you get

Logon Error:

If the server encounters an error that prevents a login from succeeding,
the client will display the following error mesage. 

To determine the true reason for the failure, the administrator can look
in the server's error log where a corresponding entry will be written. 

An example of an entry is: 

2006-02-27 00:02:00.34 Logon     Error: 18456, Severity: 14, State: 8.
2006-02-27 00:02:00.34 Logon     Login failed for user '<user name>'.
[CLIENT: <ip address>]
The key to the message is the 'State' which the server will accurately
set to reflect the source of the problem. In the example above, State 8
indicates that the authentication failed because the user provided an
incorrect password. The common error states and their descriptions are
provided in the following table: 

ERROR STATE     ERROR DESCRIPTION
2 and 5        Invalid userid
6              Attempt to use a Windows login name with SQL
Authentication
7              Login disabled and password mismatch
8               Password mismatch
9               Invalid password
11 and 12      Valid login but server access failure
13             SQL Server service paused
18             Change password required

State 16 = Does not have access to database. 

Regards

Michael



-----Original Message-----
From: Rob Harrison [mailto:rharri...@volumatic.com] 
Sent: Monday, 12 September 2011 8:28 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Wix CreateDatabase failure to connect to remote SQL
Server Express 2005

Hi,

Using the Wix 3.5 release, the attached Wix project fails to create a
database on the remote SQL Server Express 2005 machine using SQL
authentication. The following error is reported in the MSI log snippet:

------ MSI log ----------------------------------------------------
MSI (s) (E8:08) [11:03:50:456]: Executing op:
ActionStart(Name=CreateDatabase,Description=Creating Databases,)
MSI (s) (E8:08) [11:03:50:456]: Executing op:
CustomActionSchedule(Action=CreateDatabase,ActionType=25601,Source=Binar
yData,Target=**********,CustomActionData=**********)
MSI (s) (E8:58) [11:03:50:467]: Invoking remote custom action. DLL:
C:\WINDOWS\Installer\MSI395.tmp, Entrypoint: CreateDatabase
CreateDatabase:  Error 0x80004005: failed to create to database:
'TestDb', error: unknown error

Error 26201. Error -2147467259: failed to create SQL database: TestDb,
error detail: unknown error.
MSI (s) (E8:58) [11:04:09:043]: Product: TestCreateDb -- Error 26201.
Error -2147467259: failed to create SQL database: TestDb, error detail:
unknown error.

Action ended 11:04:09: InstallFinalize. Return value 3.
------ MSI log ----------------------------------------------------
 
My remote server (named Win7-64) is a Windows 7 64-bit machine with SQL
server installed and configured to allow remote access via port TCP/IP
1433. I can connect to SQL Server and create the database remotely using
other mechanisms including Management Studio Express and a native C++
test project using SQL Native Client ADO.

I've even managed to embed a custom Vbscript action into the Wix script
that will create the database remotely via ADO using Sql Auth, however
it seems more correct to use the in-built SqlDatabase Wix elements.

Can anyone help? Suggestions appreciated,
Rob.

------- Product.wxs ------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
     xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension";
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";>
  
        <Product Id="d7acc7da-b4d7-4678-8381-27c798d6b8fd" 
           Name="TestCreateDb" 
           Language="1033" 
           Version="1.0.0.0" 
           Manufacturer="TestCreateDb" 
           UpgradeCode="1aff6a39-41bc-4d67-ae36-faf528bd8b7b">
    
                <Package InstallerVersion="300" Compressed="yes" />

                <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <util:User Id="SqlUser"
               Name="sa"
               Password="some-password" />                
    
                <Directory Id="TARGETDIR" Name="SourceDir">
                        <Directory Id="ProgramFilesFolder">
                                <Directory Id="INSTALLLOCATION"
Name="TestCreateDb">

          <Component Id="TestDbCreate"
                     Guid="D94463D3-4220-4037-8E6C-78572741A247">

            <File Id="FileTxt"
                  Source="file.txt" />
            
            <sql:SqlDatabase Id="TestDb"
                             Database="TestDb"
                             User="SqlUser"
                             Server="Win7-64"
                             CreateOnInstall="yes"
                             DropOnUninstall="yes">
              
            </sql:SqlDatabase>
            
          </Component>
          
                                </Directory>
                        </Directory>
                </Directory>

                <Feature Id="ProductFeature" Title="TestCreateDb"
Level="1">
      <ComponentRef Id="TestDbCreate" />
                </Feature>
        </Product>
</Wix>
------- Product.wxs ------------------------------------------------
********************************************************

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this communication is
strictly prohibited. If you have received this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy
version.

********************************************************


------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to