Make sure to include the port number after SQL host name when setting up VMware vCD 1.5.1 using SQL

While setting up VMware vCloud Director  1.5 using MS SQL Server, you will need to enter the SQL Server & database information during the configuration phase of the setup. Although during the configuration wizard you are asked which port SQL Use and the answer to that is given to be “default” which you will assume it will revert to the correct MS SQL Server port 1433, it does not to work out that way in vCloud Director 1.5.1 for some reason. To avoid having a problem with the setup, I would recommend you do the following when answering the database info in the vCloud Director wizard.

vCloud Director 1.5.1 setup tip when using MS SQL Server

– Add the port 1433 after the MS SQL server host name when asked for the SQL Server Hostname so your answer for that field will look something like this:   MSSQLSVR001.VT.com:1433

– Change the SQL port from default to 1433

OK, wondering what error you will get if you don’t do that. Actually the installation will complete successfully, though the vCloud Director web page will not load. Further in the vcloud-container-debug.log log file under /opt/vmware/vcloud-director/logs you will see errors like showing below:

VMware vCloud Director 1.5.1.622844, Eastern Standard Time, vcloud.VT.com (192.168.2.15)
2012-06-12 18:01:36,017 | INFO | Start Level Event Dispatcher | ServiceInitializationTracker | Application startup begins: 6/12/12 6:01 PM |
2012-06-12 18:01:36,261 | DEBUG | Start Level Event Dispatcher | EncryptionManager | EncryptionManager configured with system key. |
2012-06-12 18:01:36,287 | DEBUG | Start Level Event Dispatcher | PassThroughDecrypter | decrypting |
2012-06-12 18:01:36,413 | DEBUG | Start Level Event Dispatcher | EncryptionManager | EncryptionManager has been loaded successfully. |
2012-06-12 18:01:42,727 | DEBUG | Start Level Event Dispatcher | PooledConnection | Unable to connect to database. |
java.sql.SQLException: Unable to get information from SQL Server: vCloudDB01.
at net.sourceforge.jtds.jdbc.MSSqlServerInfo.<init>(MSSqlServerInfo.java:91)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:276)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
at com.vmware.vcloud.common.jdbcpool.PooledConnection.connectUsingDriver(PooledConnection.java:215)
at com.vmware.vcloud.common.jdbcpool.PooledConnection.connect(PooledConnection.java:154)
at com.vmware.vcloud.common.jdbcpool.ConnectionPool.createConnection(ConnectionPool.java:736)
at com.vmware.vcloud.common.jdbcpool.ConnectionPool.borrowConnection(ConnectionPool.java:662)
at com.vmware.vcloud.common.jdbcpool.ConnectionPool.init(ConnectionPool.java:514)
at com.vmware.vcloud.common.jdbcpool.ConnectionPool.<init>(ConnectionPool.java:156)
at com.vmware.vcloud.common.jdbcpool.DataSourceProxy.createPool(DataSourceProxy.java:95)
at com.vmware.vcloud.common.jdbcpool.DataSourceProxy.getConnection(DataSourceProxy.java:106)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

OK, you might hit this post as you already did not add the port number after the hostname while configuring your vCloud Director and now end up with the above error and none working portal and wondering how you can fix it. Sorry you should followed the right procedure installing vCloud Director the first time around. Ah just kidding. Below is the procedure you will need to update your vCloud Director SQL connection settings to fix this problem. In summary the procedure below will explain how to reconfigure the vCD SQL connection to include the port number in the host field.

Step One: Stop the vCloud Director Service using the following command: Service VMware-VCD Stop

Step Two: Stop the MS SQL Server Service or some how interrupt the vCD Server Connection to its SQL Database so when you run the ./configure command it will prompt you to change the SQL connection information. If the SQL database is available to your vCloud Director instance it will only allow you to reconfigure your certificate but not your Database connection.

Step Three: run the ./configure command again from /opt/vmware/vcloud-director/bin.

Step Four: When prompted to complete your vCloud Director database information, go ahead and start your SQL database Service.

Step Five: Complete your vCD Database connection settings making sure you add the port number after the host name when asked for your SQL Server host name. So your host name will look something like: VTvCDDB:1433   Look at the below screenshot for a demonstration.

The below screenshot demonstrate the difference between the SQL Database host name as seen by the JDBC driver before & after the change

Step Five: Start the vCD service when asked to. Wait for few minutes then try to access your vCD portal as well check your log files to ensure that you have no other problem.

Following the above tip should help you avoid fuzzing with database errors and vCD 1.5.1 configuration failure or fix it if you already have fallen for it. This problem is really not vCD specific but its a known JDBC problem when connecting to SQL that is many other products are currently suffering from it and being reported all over the web forums.

I hope this tip help some one avoid wasting his time debugging MS SQL Server &  vCD 1.5.1 connection.

Speak Your Mind

*