p35t173nc3
Posts: 33
Joined: Wed Apr 02, 2008 1:20 pm

SQL Scripts

Hello, basically I am trying to get some sql scripts (create a new database, with all its tables and insert data etc.) to run but failing miserably;
I am using a custom connection with connetions string: (there are two connections this one is to create the database the other creates the tables etc.)

Code: Select all

Driver={SQL Server};Server=[SqlServerBrowseComboBox];Uid=[USERNAME_PROP];Pwd=[PASSWORD_PROP];Database=master;


The scripts are all set to execute at install and the properties above are comming from a sequence of UI Dialogs. The only lines in the install logs have blanks where the above properties should be resolved. I am sure I must be doing something dumb. When do the scripts get executed/the sql connections get established? Should the properties that I define in the UI be resolvable at that time?

Please help me...
Thanks...

P.S. The browsing for servers + showing databases works gr8 (although for some reason the combobox controls don't show anything on Win2K Sp4 - I don't mind that though!)
p35t173nc3
Posts: 33
Joined: Wed Apr 02, 2008 1:20 pm

Re: SQL Scripts

Ok never mind... It seems that the reference to ([SqlServerBrowseComboBox]) a private property was causing the problem... now to figure out how to check if the specyfied database is in the list returned by the browse database action.

P.S. The combobox control just doesn't display the popup for some reason... The log says:

Code: Select all

DEBUG: Error 2826:  Control BottomLine on dialog SQLConnectionDlg extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: SQLConnectionDlg, BottomLine, to the right
DEBUG: Error 2826:  Control BannerLine on dialog SQLConnectionDlg extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: SQLConnectionDlg, BannerLine, to the right
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Scripts

Hi,
It seems that the reference to ([SqlServerBrowseComboBox]) a private property was causing the problem
Indeed, private properties cannot pass their value from InstallUISequence (when the dialogs are shown) to InstallExecuteSequence (when the scripts run). A solution is to set a public property to the value of "SqlServerBrowseComboBox" before the install process starts. For this you can use a Property set with Formatted custom action scheduled right above"InstallUISequence" -> "ProgressDlg". The public property can then be used in the connection string.
now to figure out how to check if the specyfied database is in the list returned by the browse database action.
I'm not sure I understand what you mean. Can you please give me more details about this?
P.S. The combobox control just doesn't display the popup for some reason... The log says:

DEBUG: Error 2826: Control BottomLine on dialog SQLConnectionDlg extends beyond the boundaries of the dialog to the right by 3 pixels
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2826. The arguments are: SQLConnectionDlg, BottomLine, to the right
All installation dialogs have by default a line in the lower part. This line is longer than the dialog in order to look better. The error you mentioned is caused by the fact that the line is longer than the dialog. Please note that this doesn't affect the functionality of the installer in any way.
for some reason the combobox controls don't show anything on Win2K Sp4
Unfortunately older Windows versions don't determine the size of the combo correctly. A solution is to modify the size of the combo manually:
- go to the "Dialogs" page and select the combo with the problem
- in the "Properties" pane set the "Height" to a high value, for example 100
- rebuild the project

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
p35t173nc3
Posts: 33
Joined: Wed Apr 02, 2008 1:20 pm

Re: SQL Scripts

now to figure out how to check if the specyfied database is in the list returned by the browse database action.


I'm not sure I understand what you mean. Can you please give me more details about this?
Hi Cosmin, thanks for your quick reply; I wasn't expecting you so early...

Basically I need to determine if the selected database already exists on the target sql server; since I only want to create a new database if it doesn't already exist. Essentially I just need a way to parse the Combobox and check if the specified database is in there already. Would I need to write a custom action?

Also, there is a different problem with the SQL Server Combobx in that if there are multiple instances of SQL running on a machine then only one of them is displayed in the list (even though all of them are returned by the custom action? i.e. I have psi-qa, psi-qa\sql2005, psi-qa\sql2008 but I only see psi-qa in the Combobox)

Again thanks for the reply and sorry for the somewhat newbie problems :p
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Scripts

Hi,
Basically I need to determine if the selected database already exists on the target sql server; since I only want to create a new database if it doesn't already exist. Essentially I just need a way to parse the Combobox and check if the specified database is in there already. Would I need to write a custom action?
Yes, this requires a custom action. However, it's not complicated because the databases from the combo are listed in the "SqlServerDatabases" property separated by commas. The custom action can parse the value of the property and determine if the selected database is already created.
Also, there is a different problem with the SQL Server Combobx in that if there are multiple instances of SQL running on a machine then only one of them is displayed in the list (even though all of them are returned by the custom action? i.e. I have psi-qa, psi-qa\sql2005, psi-qa\sql2008 but I only see psi-qa in the Combobox)
Perhaps not all instances are found. You can try using an edit box with the property "SqlServerBrowseOutput". When the installation runs and the SQL servers are browsed, this property should be set to a comma separated list of the servers found.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
p35t173nc3
Posts: 33
Joined: Wed Apr 02, 2008 1:20 pm

Re: SQL Scripts

Hi Cosmin,
Perhaps not all instances are found. You can try using an edit box with the property "SqlServerBrowseOutput". When the installation runs and the SQL servers are browsed, this property should be set to a comma separated list of the servers found.
i had already checked and in the logs the CustomAction does return all the servers. I believe the problem has to do with the value portion containing only the server name and not the sql instance name i.e. psi-qa\sql2008; I know that there is a problem with windows combobox component where if the value of 2 or more items are the same, even when the display text for each is different, the combobox will display only 1 of the items.

Again thanks for the help... This is some of the best support I have ever received, plus your product is extrememly good.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Scripts

Hi,
I believe the problem has to do with the value portion containing only the server name and not the sql instance name i.e. psi-qa\sql2008; I know that there is a problem with windows combobox component where if the value of 2 or more items are the same, even when the display text for each is different, the combobox will display only 1 of the items.
This is not the case for Windows Installer combo boxes. The combo should contain all servers or none. Can you please try using an edit box like I explained to see what servers are found? If the edit box shows all instances, please send us the .AIP (project) file you are using to support at advancedinstaller dot com so we can investigate it.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
p35t173nc3
Posts: 33
Joined: Wed Apr 02, 2008 1:20 pm

Re: SQL Scripts

Hello Cosmin, sorry for the delay, things got a bit hectic around here...

I think I have figured it out; When running the installation on pre Vista windows using the broadcast discovery method all servers are returned as expected. On Vista however it seems to return the same list that the other browse method returns regardless of which option I have selected. This indicates to me that on Vista the browse method always runs with [SqlServerBrowseMethod] = 1.

Is it at all possible for me to get a copy of the sql.dll method code so that I can see what it is actually doing?

The reason I ask is that, for my existing installion package - which I made some 3 years ago using InstallAnywhere - I implemented the exact same broadcast server browse method; which on Vista only returned sql instances on the localhost intrerface. I have since figured out how to fix this: by changing from the global broadcast address 255.255.255.255 to the LAN broadcast addesss being 192.168.0.255 with subnet mask 255.255.255.0; i.e. 255 where the subnet mask is 0. And this works perfectly... If you could have a look that would be great, and If you can get me the code that would be even better as I will be able to build my own dll in the mean time. (I just don't have the time to refresh my c++ right now :D )

Thanks Cosmin!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Scripts

Hi,
On Vista however it seems to return the same list that the other browse method returns regardless of which option I have selected. This indicates to me that on Vista the browse method always runs with [SqlServerBrowseMethod] = 1.
Please note that this feature is not related to the target Windows version. Most likely the SQL configuration is different on the Vista machine.
Is it at all possible for me to get a copy of the sql.dll method code so that I can see what it is actually doing?
I'm afraid we cannot give you the source code for this.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
p35t173nc3
Posts: 33
Joined: Wed Apr 02, 2008 1:20 pm

Re: SQL Scripts

Hi Cosmin,
Please note that this feature is not related to the target Windows version. Most likely the SQL configuration is different on the Vista machine.
The UDP broadcast method of SQL server discovery has nothing to do with the SQL Server setup on the machine running the installation. The SQL Server instances that are not being returned are running on a Windows 2003 server on the network. These instances are returned correctly on pre Vista machines but not on Vista+ machines.

Nevertheless, I guess I will have to write my own implementation of the browse method at some point.

Thanks anyway,
Daniel
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Scripts

Hi Daniel,

Perhaps the installer doesn't have enough privileges to access them. You can try running the MSI as an Administrator to see if the servers are found.

For "Windows Network Manager API" you can use the information in these articles:
NetServerEnum ('servertype' = SV_TYPE_SQLSERVER)
SERVER_INFO_101 (SERVER_INFO_101 => 'sv101_comment' field)

For ODBC Driver Manager (SQLBrowseConnect function) you can read:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
http://msdn.microsoft.com/en-us/library/ms130926.aspx
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”