SQL connection validation - Advanced Installer Community
narsingani
Posts: 23
Joined: Thu Sep 12, 2013 4:59 am

SQL connection validation

Hi All,

I am very new to Advanced Installer and building MSI file using Client and Server application. The Server installation process requires a MS SQL connection. I have added SQLConnectionDlg and configured connection by following "http://www.advancedinstaller.com/user-g ... ction.html" guide line. However when I run the installer it does not validate the SQL connection and processes to the next step. I need to validate all SQL connection settings and retun an error message if any of these is incorrect. This includes SQL Server IP/Instance, SQL Database Name, SQL Login name and SQL Password.

I really appreciate any help on this.

Thanks in advance!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL connection validation

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

I'm not sure why this happens. Did you carefully follow our "Test SQL Connection" article steps? If so, can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
narsingani
Posts: 23
Joined: Thu Sep 12, 2013 4:59 am

Re: SQL connection validation

Daniel,

I am not sure how to validate SQL connection for the individual parameter. I have SQL Server Name which I have finally got validation working but it does not checking all other parameters Database Name, SQL Login Name, SQL Password. Please refer to the attache screenshot and help me validating other parameters. Basically if any one of these parameters fail then the setup should not go further until the correct details entered.

Thanks in Advance!
Attachments
SQLConnectionDlg
SQLConnectionDlg
Capture.JPG (56.32 KiB) Viewed 10850 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL connection validation

Hello Upendra,

In order to achieve this you can proceed like this:
- go to "Custom Actions" page and add the "Test ODBC Connection" custom action without sequence
- go to "Dialogs" page and add "SQLConnectionDlg" dialog
- remove the "ODBC Resource" static text and edit box controls
- on [Next] button add the following published events:
  • Control Event: Set installer property value
    Property: [SqlConnectionString]
    Argument: Driver=[\{]SQL Server[\}];Server=[SERVER_PROP];Port=[PORT_PROP];Uid=[USERNAME_PROP];Pwd=[PASSWORD_PROP];Database=[DATABASE_PROP];
    Condition:

    Control Event: Display a specific child dialog
    Argument: <NedDialog>
    Condition: NOT (DATABASE_PROP AND USERNAME_PROP AND PASSWORD_PROP)

    Control Event: Execute custom action
    Argument: TestODBCConnection
    Condition: NOT (SqlConnectionString = "") AND DATABASE_PROP AND USERNAME_PROP AND PASSWORD_PROP

    Control Event: Display a specific dialog
    Argument: FolderDlg
    Condition: SqlConnectionOK = "1" AND DATABASE_PROP AND USERNAME_PROP AND PASSWORD_PROP
- build and run your project

Also, I've attached a sample project created using version 10.5.2 of Advanced Installer which implements a similar scenario.
sample.zip
(3.36 KiB) Downloaded 377 times
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
narsingani
Posts: 23
Joined: Thu Sep 12, 2013 4:59 am

Re: SQL connection validation

Thanks for your reply Daniel,

It is now validating SQL connection parameters correctly. However I have edited the ini file and now I am getting the attached error message. I am not sure what I am doing wrong. I need SQL parameters (entered at the time of installtion) into my ini file along with some other properties. I had them before but now some how I am getting the error during the installation process "Section missing for .ini action. I also have added Control Conditions for each parameters so the feeded information can go through the ini file. Please see all attached screenshots.

Thank you in Advance.
Attachments
SQL ConnectionDlgControlCondition
SQL ConnectionDlgControlCondition
SQLConnectionDlg_Control Conditions.JPG (75.64 KiB) Viewed 10834 times
ini file
ini file
inifile.JPG (49.59 KiB) Viewed 10834 times
Error Image
Error Image
Install Error.JPG (32.57 KiB) Viewed 10834 times
narsingani
Posts: 23
Joined: Thu Sep 12, 2013 4:59 am

Re: SQL connection validation

Danielle,

Please ignore my previous query, I have worked it out and fixed it. However I still require your assistance to store encrypted password in the .ini file. The installation process also stores an .ini file in the same directory as the .exe file. The ini file stores SQL Server Name, SQL Server Database, SQL User and SQL Password. It is working perfectly except the password in .ini file appears without any encryption. I need to store the password in the ini file as encrypted, however user still be able to overwrite the password in other words it should not be disabled/inaccessible.

Thank you in Advance!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL connection validation

Hello Upendra,

I'm afraid we don't have predefined support for encrypting an INI value. However, in order to achieve what you want you can develop your own custom action which will encrypt the related property value.
The custom action can be added as a custom action without sequence and can be triggered using an "Execute custom action" published event on [Next>] button.

Also, you can take a look on "How to encrypt a value in ini file" article which could be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
narsingani
Posts: 23
Joined: Thu Sep 12, 2013 4:59 am

Re: SQL connection validation

Thanks for your reply Daniel,

I am not sure how to create a custom action to encript the property in ini file. I am trying to see if I can work it out.
I have another issue. Part of the installation checks the current database version of the application and if the version is the less than current version then it prompts the user and upgrades the database using sequential sql scripts. I am not sure how to check the current db version and apply the scripts accordingly. I will appreciate if you can help me on this. I also want to store scripts in the MSI but which should only be used when the upgrade is required and should not be accessible to the user.

Thanks for your continuous assistance.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL connection validation

Hello Upendra,

In order to achieve this you can use an SQL Query which will check the current database version and store the result set in an installer property. Then you can use the above property in the "SQL Script tab -> Condition field" of the upgrade SQL scripts.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”