无法连接sql-server数据库

时间:2014-03-07 12:19:18

标签: sql-server alfresco jtds

我正在尝试将Alfresco Community 4.0(安装在Tomcat7中)与SQL Server 2012连接,但我一直遇到“拒绝连接”的问题。使用mysql,一切正常。

我已关闭防火墙并启用了TCP / IP。 SQL Server服务也在运行,所以我无法弄清楚问题所在。我的驱动程序也在工作,因为我有另一个应用程序(orbeon)使用它。

你知道发生了什么吗?我的配置如下:

db.name=alfresco
db.username=alfresco
db.password=alfresco
db.host=127.0.0.1
db.port=1433
db.driver=net.sourceforge.jtds.jdbc.Driver
db.url=jdbc:jtds:sqlserver://${db.host}:${db.port}/${db.name}
db.txn.isolation=4096

我的错误是:

Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:215)

非常感谢您的协助。

2 个答案:

答案 0 :(得分:0)

你需要解决这个问题:

db.url=jdbc:jtds:sqlserver://${db.host}:${db.port}/${db.name}

做类似以下的事情;

jdbc:jtds:sqlserver://DAN-Aladino-vs.usersad.everis.int:1433/AladinoSFA2

答案 1 :(得分:0)

您需要为用户启用访问权限才能访问该表。

此处数据库名称为&#34; alfresco&#34;。

所以,你可以找到安全性 - &gt;登录 - &gt;用户列表。右键点击用户&#34; alfresco&#34;并转到属性。在此您将找到用户映射。现在您需要启用访问权限,以便将用户转移到该特定数据库。

试试这个......