PDA

View Full Version : Dynamically creating extra SQL Server connections



jonathanqis
11-09-2011, 10:13 AM
I am trying to create an installation that allows the user to specify 1 to n runnung SQL servers to install components to.
It is an Installscript MSI project.
Since I do not know how many servers the user will install to, thus, how many connections to configure.
If I add a set number of connections with associated SQL scripts I don't see any good way to limit the number of connections that display their configuration dialog to just the number that the user requires.

Therefore, I'm looking into how to create connections in InstallScript as the UI runs.

I have tried creating extra rows in the ISSQLConnection table and in the ISSQLConnectionDBServer and ISSQLConnectionSCript table.
I am doing this in the OnFirstUIBefore handler just before OnSQLLogin is called.
the SQLRTTestConnection2 call in OnSQLLogin returns a 10 - 'The function could not find a valid record in ISSQLDBMetaData table'.

If I pre-create two connections in the InstallShield project it works without error.

I have now reduced my scripting changes to merely re-inserting the second connections row entry in the ISSQLConnection table
but it still errors immediately after displaying the second connection configuration dialog.
The error number displayed is 27554 which is consistent with the previous error.

Has anyone tried anything like this to create an SQL connection in InstallScript whilst running the install ?
Does anyone have any ideas what I may be missing. E.g. refreshing of any associations or inconsistencies in the MSI tables.

Any help greatly appreciated.

Thanks in advance.