Configuring vCloud Director 1.5 and MS SQL 2008 R2 to Use a Named Instance
This isn’t a subject that comes up everyday, but I’ve seen it enough times that I thought it warranted a quick write up, so here we go. The biggest problem is that typically when you see a named instance of MS SQL installed, it’s alongside the default (MSSQLSERVER). For most applications, this isn’t an issue. You connect up to the named instance by giving the application or ODBC connection syntax similar to ‘SERVER\INSTANCE’, and it works just fine; however, with vCloud Director, which uses Java Database Connectivity (JDBC) to connect to MS SQL, this doesn’t quite work. JDBC doesn’t seem to be able to handle dynamic ports, at least with MS SQL 2008 R2 and vCloud Director 1.51, so we either have to add a secondary network interface or give your named instance a different TCP port. In this article, we’ll take the second approach.
By default, your MSSQLSERVER instance is going to be using TCP 1433, so we’re going to have to choose something else. MS SQL Monitor uses TCP (and UDP) 1434, so we’ll go with TCP 1435. My instructions here are going to be specific to MS SQL 2008 R2 and MS Windows Server 2008 R2, but they should translate pretty easily for earlier and future versions of both MS SQL and MS Windows Server.
1. Before we begin, a quick ‘netstat –a’ to show what ports SQL is listening to.
2. Launch the SQL Server Configuration Manager.
3. In the SQL Server Configuration Manager, under SQL Server Network Configuration, click ‘Protocols for INSTANCE’, then double-click TCP/IP.
4. On the TCP/IP Properties window, as below, you should observe each interface as having a ‘0’ in TCP Dynamic Ports.
5. If you look at the TCP/IP Properties for the MSSQLSERVER instance, you should see something similar to the screenshot below. Note that TCP Port 1433, the default, is in use on each interface.
6. Now, back on TCP/IP Properties for your named instance, remove the ‘0’ from TCP Dynamic Ports for each instance, and type in ‘1435’ for TCP Port on each instance.
7. Hit OK. You should see a prompt to letting you know changes are saved, but that they won’t take effect until your named instance service is restarted.
8. To make the changes take effect, we’ll have to restart the SQL service for your named instance. This is a right-click SQL Server in Microsoft SQL Server Management Studio > Restart OR right-click SQL Server (INSTANCE) in Services > Restart
9. Now, if you do a ‘netstat –a’, you’ll see that SQL is now listening on TCP 1433 and 1435.
10. Now, to configure vCloud Director. This isn’t going to include the entire setup for vCloud Director; you can find that in the Install and Configure Guide from VMware, linked at the end of the article. This is only going to show the database connection configuration, as in the screenshot below.
a. Type in 2 for Microsoft SQL Server.
b. Type in the IP address or fully-qualified domain name (FQDN) of your MS SQL Server.
c. Type in 1435 for the database port, as that’s what we defined within MS SQL.
d. Type in the database name.
e. Type in the instance name.
f. Type in the username and password.
11. Once that’s done, the JDBC connection will be created, and the database will be populated. You’ll know you’ve been successful if you see a prompt similar to the one below. Type ’y’ and hit enter to start the vmware-vcd service.
12. You’re done!