This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Call SQL-Script only if DB engine installed
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 29, 2008
09:54 AM
Call SQL-Script only if DB engine installed
Hello
I am writing a InstallScript MSI for a software which can use a local SQLExpress DB, but also a remote database.
I have added SQLExpress as prerequisite which the user can choose to not install.
I defined a feature to install the SQL scripts to generate the schema, and call them within the "SQL Script" view. Is there any way to only execute these SQL-Scripts when SQLExpress is installed?
I though I could use the "Conditional Statement Builder" for this feature to check if I find the relevant entry of the DB in the registry, but I have no clue how to check for a registery entry there.
Any idea how I can make the calling of these SQL-Scripts dependent on the presence of the local DB?
Thank you in advance.
I am writing a InstallScript MSI for a software which can use a local SQLExpress DB, but also a remote database.
I have added SQLExpress as prerequisite which the user can choose to not install.
I defined a feature to install the SQL scripts to generate the schema, and call them within the "SQL Script" view. Is there any way to only execute these SQL-Scripts when SQLExpress is installed?
I though I could use the "Conditional Statement Builder" for this feature to check if I find the relevant entry of the DB in the registry, but I have no clue how to check for a registery entry there.
Any idea how I can make the calling of these SQL-Scripts dependent on the presence of the local DB?
Thank you in advance.
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 30, 2008
02:26 PM
You could use the System Search Wizard to read the registry information and store it in a property that you could then use in a condition; or else you could use RegDBSetDefaultRoot and RegDBKeyExist to see if the information is there, and then similarly use MsiSetProperty to create a property that you can then use in a condition.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 31, 2008
06:57 AM
I tried it with the condition, but I guess I made something wrong, as InstallShield always wants to build up connection with the SQLServer even when no SQLServer is present.
Under System Search, I defined a search for a regKey:
Registry Root: HKEY_LOCAL_MACHINE
Registry Key: SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\Setup
Registry Value: SQLPath
stored as property IS_DB_PRESENT
Under Setup Design, I have a feature localDB:
Install Level: 0
Condition: Level 1 Condition IS_DB_PRESENT >< "MSSQL"
Am I right, localDB is normally not installed, except when IS_DB_PRESENT contains MSSQL?
At the moment, I am not sure if it works, it tries nevertheless OnSQLLogin.
Under System Search, I defined a search for a regKey:
Registry Root: HKEY_LOCAL_MACHINE
Registry Key: SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\Setup
Registry Value: SQLPath
stored as property IS_DB_PRESENT
Under Setup Design, I have a feature localDB:
Install Level: 0
Condition: Level 1 Condition IS_DB_PRESENT >< "MSSQL"
Am I right, localDB is normally not installed, except when IS_DB_PRESENT contains MSSQL?
At the moment, I am not sure if it works, it tries nevertheless OnSQLLogin.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 31, 2008
09:59 AM
You also need to add a code to the beginnig of OnSQLLogin() that will return the event immediately when the IS_DB_PRESENT property does not contain MSSQL.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 31, 2008
10:01 AM
Problem solved.
The OnFirstUIBefore() calls OnSQLLogin which tries to connect to the database, even if no database engine is present.
I added a method checking the created property IS_DB_PRESENT above to make sure the database is present before calling OnSQLLogin.
Now, I call OnSQLLogin and install the localDB feature only when the database engine is present.
Thank you for your help Robert.
Now I need to find out in which directory Excel is installed to add an excel macro...
The OnFirstUIBefore() calls OnSQLLogin which tries to connect to the database, even if no database engine is present.
I added a method checking the created property IS_DB_PRESENT above to make sure the database is present before calling OnSQLLogin.
Now, I call OnSQLLogin and install the localDB feature only when the database engine is present.
Thank you for your help Robert.
Now I need to find out in which directory Excel is installed to add an excel macro...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 31, 2008
10:11 AM
Your method will work for local DB only.
There is no way the registry key will tell you if a remote DB was installed.
There is no way the registry key will tell you if a remote DB was installed.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 01, 2008
01:02 AM
ISNewone wrote:
Your method will work for local DB only.
There is no way the registry key will tell you if a remote DB was installed.
That is right and also intended that way. The application supports a local SQLExpress database and provide the needed stuff in the installer to support it.
The application also supports remoteDB (but SQLExpress, Oracle and MySQL). Configuring and installing these databases are not part of the installer. The application will use them if configured properly.