Trying to connect my Java Spring app on Tomcat to my sqlserver database with jdbc. Getting error:
"Request processing failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The connection to the host BEN-790, named instance sqlexpress 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.)"
pom.xml
<!-- Server Connection -->
-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.6.RELEASE</version>
</dependency>
<!-- Test -->
-<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
-<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.FINAL</version>
</dependency>
-<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
-<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
-<build>
-<plugins>
-<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
-<configuration>
-<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
-<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
-<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
-<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
-<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
+<configuration>
</plugin>
-<plugin>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</plugin>
</plugins>
my servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" xmlns:context="http://www.springframework.org/schema/context" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/mvc">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven/>
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources location="/resources/" mapping="/resources/**"/>
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
-<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property value="/WEB-INF/views/" name="prefix"/>
<beans:property value=".jsp" name="suffix"/>
</beans:bean>
<!-- Enables us to use message.properties files -->
-<beans:bean class="org.springframework.context.support.ResourceBundleMessageSource" id="messageSource">
<beans:property value="home" name="basename"/>
</beans:bean>
<!-- Enable connection to MS SQL -->
-<beans:bean class="org.apache.commons.dbcp.BasicDataSource" id="dataSource">
<beans:property value="com.microsoft.sqlserver.jdbc.SQLServerDriver" name="driverClassName"/>
<!-- <beans:property name="url" value="jdbc:jtds:sqlserver://localhost/bens;instance=sqlexpress;useNTLMv2=true;domain=BEN-790"/> -->
<beans:property value="jdbc:sqlserver://BENS-790\SQLEXPRESS;databaseName=TIGGER" name="url"/>
<beans:property value="COMPANY\bens" name="username"/>
<beans:property value="" name="password"/>
</beans:bean>
<!-- <beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <beans:property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/> <beans:property name="url" value="jdbc:sqlserver://COL-INFA:1433;databaseName=bens"/> <beans:property name="username" value="bens"/> <beans:property name="password" value="MyPwd"/> </beans:bean> -->
<context:component-scan base-package="com.company.tigger"/>
</beans:beans>