cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sbrown
Level 6

SQL error when run during Modify

In my installation I have 2 SQL scripts. These 2 scripts run on different SQL instances, usually different machines. If both scripts are run during the first install, no problem.
One script runs "On" installation, I don't seem to have any problems with this script. The other script may or may not run during the first install. You can run the install in modify mode and select the feature associated with this script which is when I have the problem. I get the following error:
Error 27502.Could not connect to Microsoft SQL Server ".[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. (17)

In OnMaintUIBefore I call the OnSQLLogin function and fill in the same data that I use if this function is displayed during OnFirstUIBefore.
This looks to me like it is not using the connection data from the OnSQLLogin function. (InstallScript MSI project)

Any ideas??
Labels (1)
0 Kudos
(4) Replies
sbrown
Level 6

I think I have found half my problem.
I put a messagebox in a custom action to display all the SQL connection info before it runs the script but after the UI.
Since the database can be on any machine the user selects the server. This selection is not being stored.
I used:
SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword );
MessageBox ("Connection: " + szConnection + "; Server: " + szServer + "; DB: " + szDB + "; User: " + szUser + "; PW: " + szPassword, INFORMATION );

szServer was blank. Everything else was there.

What do I need to do to store the server?
0 Kudos
sbrown
Level 6

OK Acresso Software, I can't find any documentation on how to store the db server. Upon further testing it looks like the function calls inside OnSQLLogin work for the first time install but they don't work if you call the same OnSQLLogin during a maintenance install.

Is this a bug or am I not looking in the right place for documentation?
0 Kudos
hidenori
Level 17

InstallShield stores the SQL login information in the registry during the initial installation, and reuses them during the maintenance and uninstallation. In order to turn off this behavior, you need to specify the IS_SQLSERVER_DO_NOT_USE_REG Windows Installer property. Please add the following code before the OnSQLLogin() call in the OnMaintUIBefore and see if it solves your issue:

MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_DO_NOT_USE_REG", "1");
0 Kudos
sbrown
Level 6

Looks like that worked.
Thanks.
0 Kudos