3

I'm trying to set up TeamCity 9 locally to a local SQL Server Instance and getting the following error.

The connection to the host localhost, named instance (localdb)\v11.0 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.

SQL exception: The connection to the host localhost, named instance (localdb)\v11.0 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.

I've tested the connection via SSMS and the credentials I'm supplying the TC web set up are the same. The login has rights to the table.

Using sqljdbc41.jar

It has to be something simple.

Thanks!

Will Lopez
  • 2,089
  • 3
  • 40
  • 64

1 Answers1

1

It is difficult to know what might be the issue with your environment but I can tell you what worked for me. The key item was to use the JTDS JDBC driver rather than the Microsoft JDBC driver.

Download the latest driver from http://jtds.sourceforge.net/

Unpack the downloaded zip file into the %TEAMCITY_DATA_PATH%/config folder

If you are using NTLM (i.e. Windows) authentication to connect to your database then specify the following for the database.properties file:

# Database: Microsoft SQL server (via jtds driver)   
connectionUrl=jdbc:jtds:sqlserver://localhost:1433/TeamCity
#connectionProperties.user=
#connectionProperties.password=

NOTE: This requires the TeamCity windows service to run under the credentials of the account that is the owner of the database. In addition, the ntlmauth.dll file needs to be copied from the JTDS zip file\x86\SSO folder to the TeamCityHome\bin folder as well.

If you are using SQL authentication to connect to your database then specify the following for the database.properties file:

# Database: Microsoft SQL server (via jtds driver)   
connectionUrl=jdbc:jtds:sqlserver://localhost:1433/TeamCity
connectionProperties.user=<SQL Login Name>
connectionProperties.password=<SQL Login Password>

Because the JTDS driver does not have a default port to use, you must specify a port in the value supplied for the connectionUrl.

If you use named instance you can specify the instance name by following means:

For example if the instance name is sqlexpress then either add the instance property into the connection URL, like the following:

connectionUrl=jdbc:jtds:sqlserver://localhost:1433/TeamCity;instance=sqlexpress

Or, specify corresponding property in the database.properties file:

connectionProperties.instance=sqlexpress

See also: http://confluence.jetbrains.com/display/TCD9/Setting+up+an+External+Database