Check the SQL Server 2005 express and Port 1433 - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

JohnJustus
Posts: 4
Joined: Fri Aug 19, 2011 8:50 am

Check the SQL Server 2005 express and Port 1433

Hi,

I am using the advance installer version 7.6.1, with SQL Server Express with default port 1433.

I want to verify the availability of both SQL Express installation and the port number before proceeding the installation process, In case if SQL Express service is available through any other port other than the default port, or the port 1433 is not available, then I want to Abort/Stop/Cancel the installation process using Requirements -> Launch Conditions option tree or some other way.

Which one is the convenient method to do this. Please mention the steps along with the condition.

Thanks In advance.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Check the SQL Server 2005 express and Port 1433

Hi John and welcome to Advanced Installer forums,

You can set the launch condition SQL Server Express from the Launch Conditions page:
http://www.advancedinstaller.com/user-g ... tware.html

To validate the connection string, you can try following this article:
http://www.advancedinstaller.com/user-g ... ction.html

There are several articles in the same category you may find helpful as well.

In case the connection string( including port ) is not valid, you can schedule an "Error message" custom action to stop the installation:
http://www.advancedinstaller.com/user-g ... #section21

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JohnJustus
Posts: 4
Joined: Fri Aug 19, 2011 8:50 am

Re: Check the SQL Server 2005 express and Port 1433

Hi Mihai,

Thanks for your post.

Still I encountered the issue.

I included the given statement as you mentioned on the link.

Microsoft SQL Server
• Name: [SqlConnectionString]
• Argument: Driver=[\{]SQL Server[\}];Server=[SERVER_PROP];Port=[PORT_PROP];Uid=[USERNAME_PROP];Pwd=[PASSWORD_PROP];
• Condition: 1 (it will be showed as AI_INSTALL)

Then also whenever I try to install the validate the connection string and connection timeout was thrown out. I am unable to move forward from this validation point.

Also that article does not contain any information about verifying the connection port 1433's availability. How can I check the availability of that port number? Incase if it is not available I need to abort the installation process.

Please help.

With Warm Regards,
John Justus.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Check the SQL Server 2005 express and Port 1433

Hi John,
Then also whenever I try to install the validate the connection string and connection timeout was thrown out. I am unable to move forward from this validation point.
That's the point of this validation. The installation cannot continue if a connection cannot be made.
Also that article does not contain any information about verifying the connection port 1433's availability.
To determine if the port is free you can use a Check TCP Port custom action. This custom action sets AI_PORT_TEST_RES property based on whether the port is free or not. So you can use this property as a custom launch condition.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JohnJustus
Posts: 4
Joined: Fri Aug 19, 2011 8:50 am

Re: Check the SQL Server 2005 express and Port 1433

Hi,

Thanks for your reply, I have tried all the possible ways and still my issue exists.

My ultimate goal is to should verify the SQL connection string and find out whether the sql server application is running at port number 1433. If not, I want to terminate the installation process immediately.

I am using Windows trusteed authentication and the connection string is
Driver={SQL Server};Server=[SERVER_PROP];Port=1433;Trusted_Connection=true;
I think it is correct. Also I need to terminate the installation process if any of the connection string component is wrong. Or I need to do any change any change in the connection string to validate the string and port simultaneously?

If the SQL Server is not connecting through the string, then I want to check whether the port number 1433 is free or not?
How can I test that? Once the port is engaged with SQL Server my installation process needs to continue, otherwise it should terminate the installation process immediately.

Please let me know the steps I need to follow.

With thanks in advance,
John Justus
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Check the SQL Server 2005 express and Port 1433

Hi John,
My ultimate goal is to should verify the SQL connection string and find out whether the sql server application is running at port number 1433. If not, I want to terminate the installation process immediately.
Most packages use a predefined connection. A connection string is mostly used by advanced users with complex configurations. In both cases, the SQL configuration can be verified through our TestODBC connection custom action (the how-to mentioned by Mihai).

Regarding the SQL Server port, I'm afraid that there is no built-in support for detecting it. Most installers use this configuration:
- add SQLConnectionDlg dialog in Dialogs page
- use its properties in your SQL connection information
- on the Next button of this dialog you can configure an SQL connection test using the same properties
- installation can be performed only if the test succeeds (the SQL connection information is correct)

Our Using SQL Scripts tutorial explains how to add the dialog and use it. The next step would be to setup the connection test on Next button. This way you can provide 1433 as default port and the user can change it if his SQL Server uses a different one.

If you really want to use only port 1433, you can try this approach:
- write a custom action which detects the SQL Server port (you will need to use custom code)
- schedule it before "InstallUISequence" -> "LaunchConditions" standard action
- save the port in an installer property
- use this property as a custom launch condition

In this case you don't need to test the connection.

Please note that only Win32 DLL and VBScript custom actions can set installer properties. Our user guide contains a sample C++ DLL custom action which may help you.
Also I need to terminate the installation process if any of the connection string component is wrong. Or I need to do any change any change in the connection string to validate the string and port simultaneously?
If you want to test the connection string, you cannot stop the installation. You can only prevent the user from continuing (he will cancel manually). If you don't test the string and use only a custom action to verify the port, the custom launch condition will stop the install automatically.
If the SQL Server is not connecting through the string, then I want to check whether the port number 1433 is free or not?
Our SQL connection testing mechanism was not designed for this. It tests the port specified by you or by the user. Usually the installer has a default port which the user can modify through SQLConnectionDlg.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JohnJustus
Posts: 4
Joined: Fri Aug 19, 2011 8:50 am

Re: Check the SQL Server 2005 express and Port 1433

Hi Team,

I am unable to solve the issue till now.

Could you please give me the procedure /script for testing the TCP port using either AI_BIND_TCP_PORT or AI_SEARCH_TCP_PORT and if the return value is FreePort or SockError then I want to terminate the installation and continue if it is UsedPort.

Thanks In advance and help me please.

With Warm Regards,
John Justus
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Check the SQL Server 2005 express and Port 1433

Hi John,

You can try this approach:
- go to "Custom Actions" page
- right-click on InstallExecuteSequence and select "Show standard action" -> "FindRelatedProducts"
- right-click on FindRelatedProducts and add a Property set with formatted custom action
- configure it to set AI_BIND_TCP_PORT property to your port
- create a New Attached Custom Action after it
- when asked for a file browse to "custact\x86" subfolder from Advanced Installer installation folder and select aicustact.dll
- in Function Name combo select CheckFreeTCPPort function
- in Launch Conditions page create this launch condition:

Code: Select all

AI_PORT_TEST_RES = "UsedPort"
This way the installation should run only if AI_PORT_TEST_RES is set to "UsedPort".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sagar
Posts: 39
Joined: Tue Dec 13, 2011 2:53 pm

Re: Check the SQL Server 2005 express and Port 1433

Hi Mihai,
Thank you for your replay,You are right it work.
I have one problem regarding execution of SQL Script.
I have created predefined SQL connection in which I have added SQL script to create new database for our Web application but I am not able to use that predefined SQL connection in "SQLConnectionDlg". I used Advanced Installer "Configuring Databases with SQL Scripts" tutorial to create sql connection.
Please tell me how to call that predefined SQL connection when user click to next button of SQLConnectionDlg.
I have one more problem regarding testing the SQL connection on SQLConnectionDlg.I display all the server name in list box, when I select (local) server name or any other server name ODBC time out error will get display.I follow the step which is given in http://www.advancedinstaller.com/user-g ... ction.html

Please give me the solution for above problem
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Check the SQL Server 2005 express and Port 1433

Hello,
Please tell me how to call that predefined SQL connection when user click to next button of SQLConnectionDlg.
This user guide article should clarify any doubts. We recommend you follow and implement the tutorial functionality onto a test project before performing any related changes onto your main project.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”