In my Last post Troubleshooting vCloud SSL Certificates Issue I have covered how to resolve the ssl certificates issue.
Once the certificate is accepted by the vCloud director configuration script the next thing is that it will ask you for the database connection details so that it can connect to vcloud database and configure it.
This was not end of life it seems as vCloud director has decided to test me one more time. This time I ran into database connection issue as the vCloud director server was unable to contact my database (MSSQL).
I have covered the database preparation steps in my post Configuring MSSQL Database for vCloud Director
I was getting the error as shown in below screenshot
I was getting a connection failure error as vCloud director setup was unable to reach my MSSQL database and I was getting socket timeout error. This was very annoying for me. I tried to telnet my server where MSSQL database is running (in my case it is running on same server where my vCenter server is running as I am using embedded SQL express as DB).
Telnet was not happening on the default port (1433) over which MSSQL listens. This was a bit strange. I decided to check on my vCenter server that whether or not it is listening on port 1433, and surprisingly it was not. I remember I haven’t changed any setting while SQL installation was in progress and went with default settings.
I have faced this kind of issue earlier so I was sure where I have to look for. The cause of this issue is that in protocol settings of MSSQL dynamic ports are selected instead of static (1433). All I needed was to change the port settings back to static from dynamic.
To do so I launched SQL Server Configuration Manager by typing mmc.exe on RUN and pressing Ctrl +M to Add/Remove new snap-in to mmc.
Pressing Ctrl + M will open a new window where you can select the snap-in which you want to add to mmc. In my case I had to select SQL Server Configuration Manager and click on Add> button to add.
Once the snap-in is added hit OK.
The next screen which pops-up will provide you options to configure your SQL server settings. To change the ports settings browse to SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for DB-Instance (VIM_SQLEXP in my case) and select TCP/IP and double click on it.
A new window will pop-up. Select “IP Addresses “tab and navigate to topmost bottom part to locate the settings named “IPALL”
In below screenshot you can see dynamic port was set to 59677 and there was no value for TCP Port (static). This was the reason why my vCloud director was unable to reach my DB.
All I needed here is to put the value “0” in dynamic port and “1433” in TCP Port field and hit apply and ok.
Clicking on apply button will tell you that some settings can only take effect after restarting the SQL services.
Go to Services.msc and restart the SQL service from there and you are good to go.
After restarting I was able to listen on port 1433 on my localhost.
Now I wanted to test telnet from the vCloud Director server to verify it is reaching DB server now. Luckily that went well and I was able to connect on port 1433.
Now it was time to go back to the vcloud configuration script and finalize the installation.
Summary: The issue occurred because MSSQL was configured to listen on dynamic ports. As a best practice it is always advisable to check the port settings in advance prior to installing/configuring any application that will connect to your MSSQL database.