繁体   English   中英

SQL Server与Spring的连接

[英]SQL server connection with spring

我创建了一个Spring MVC应用程序来连接sqlserver数据库。 我使用jtds驱动程序进行连接。

<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <beans:property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
    <beans:property name="url"
        value="jdbc:jtds:sqlserver://localhost:1433;databaseName=3PLTest;" />
    <beans:property name="username" value="sa" />
    <beans:property name="password" value="sa" />
</beans:bean>

当我尝试运行服务器时,它给出了错误。

ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect)
Nov 03, 2014 10:33:46 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/warehouse] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection] with root cause
java.net.ConnectException: Connection refused: connect

我正在使用SQLEXPRESS。 这是怎么发生的?

您是否为本地SQL Server安装启用了TCP / IP协议?

SQL Server连接被拒绝

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM