Click here to Skip to main content
15,903,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi there,

Executing SqlScript at the remote DB causes an error:

Failed to connect to SQL database. (-2147467259 myDB1)

The SqlScript is the following:

<sql:SqlString 
Id='UpdateSomething1' 
SqlDb='myDB1' 
ExecuteOnInstall='yes' 
User='SQLUser'
ContinueOnError='no' 
ExecuteOnReinstall='no' 
ExecuteOnUninstall='no' 
Sequence='26'
SQL='[SqlString]'/>


where the Db is:

<sql:SqlDatabase 
Id='myDB1' 
Database='myDB1' 
Server='[DATABASE_SERVER]' 
CreateOnInstall='yes' 
DropOnInstall='no' 
DropOnUninstall='no' 
ContinueOnError='no'/>


and the user is:

<util:User 
Id="SQLUser" 
Name="myUserName1" 
Password="password1"/>

The problem does not occur with the local DB. We extracted more specific error message from the IP traffic (the actual error that the remote MSSQL server throws):

Can not open database "myDb1" requested by the login. The login failed. <remote machine name> Login failed for user <user name>

Thank you for any help and information.

Max
Posted

1 solution

Hit this myself this week.

msiexec.exe (the windows installer process) runs as the localsystem account (SYSTEM). Typically SYSTEM does not have network access (your remote db).

You'll have to do some work with custom actions and scheduling to get your sql scripts to run under a windows account that has network access (typically the user account that launched the installer)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900