scholzr
Posts: 9
Joined: Thu May 24, 2012 6:26 pm

SQL Connection Test

I have an installer which implements the tutorial solutions for both the TestSQLConnection and the solution for selecting either SQL authentication or Windows Authentication. My issue is that when I run the TestSQLConnection defined action, the SqlConnectionString is incomplete- it is not including the Authentication information from the variable which sets the UID/PW or Integrated Security portion of the connection string. Because this portion of the string is missing, the test defaults to Windows Authentication every time. Below are the actions that are run when I click "Next" on the SQL Connection Dialogue.

1.Name = [SQL_AUTHORIZATION]
Argument = User ID=[USERNAME_PROP]; Password = [PASSWORD_PROP];
Condition = SQLAUTHENTICATION = "Sql Server Authentication"

2.Name = [SQL_AUTHORIZATION]
Argument = Integrated Security=True
Condition = SQLAUTHENTICATION = "Windows Authentication"

3.Name = [SERVER_PROP]
Argument = [SqlServerBrowseComboBox]
Condition = AI_INSTALL

4.Name = [SqlConnectionString]
Argument = Integrated Security=True
Condition = SQLAUTHENTICATION = "Windows Authentication"

5.Name = Execute custom Action
Argument = TestODBCConnection
Condition = ( NOT (SqlConnectionString = "") )

6.Name = [Display a specific dialog]
Argument = ShortcutsDlg
Condition = AI_INSTALL AND SqlConnectionOK = "1"

To complicate things even more, when the SqlConnectionString is called on the next dialog, it shows correctly (with the SQL_AUTHORIZATION in place). If I do away with the SQL_AUTHORIZATION variable in the SqlConnectionString and hard code a UID/PW, it works correctly, but as soon as i add in that variable it defaults back to always using Windows Authentication.

Anyone have any ideas?
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Connection Test

Hello,

I'm afraid I don't fully understand what you want to achieve. Can you give us more details about your scenario (maybe exemplify)? Also, can you attach a sample reproducing this behavior?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
scholzr
Posts: 9
Joined: Thu May 24, 2012 6:26 pm

Re: SQL Connection Test

I have attached an example installer file. If you run this example, regardless of whether you selece SQL Authentication or Windows Authentication, the TestODBCConnection action uses a Windows Authenticaiton mode to connect.It is like the action is being run before the connection variables are being set.
Attachments
InstallerSandbox.aip
(16.02 KiB) Downloaded 574 times
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Connection Test

Hello,

It seems that you append your SQL_LOGIN property to the SqlConnectionString property as a constant string (you have omitted the brackets). Can you please set the SqlConnectionString property, using a "Set installer property value" control event,like this:
  • Name: [SqlConnectionString]
    Argument: Driver=[\{]SQL Server[\}];Server=[SERVER_PROP];Port=[PORT_PROP];[SQL_LOGIN]
and see if the behavior still reproduce?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
scholzr
Posts: 9
Joined: Thu May 24, 2012 6:26 pm

Re: SQL Connection Test

That was an accidental omission in creating the test file. I did have it listed as a property in my actual file. I was able to get it to work though. I'm not sure how, but I recreated that dialog in my actual file and was able to get it to work. I think that I may have had an issue in the condition of the SQL_LOGIN property.

Return to “Building Installers”