I want to connect my java project to SQL Server 2005 database, but unfortunately I'm getting some problems. I am using Windows Authentification (my pc name is BOURKADIXP without password) and here is my hibernate.cfg:
我想将我的java项目连接到SQL Server 2005数据库,但不幸的是我遇到了一些问题。我正在使用Windows Authentification(我的电脑名称是没有密码的BOURKADIXP),这是我的hibernate.cfg:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.password">azerty</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://127.0.0.1/DBM6000</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
</session-factory>
</hibernate-configuration>
and here is the exception that I had:
这是我的例外:
org.hibernate.exception.JDBCConnectionException: Getting database metadata
Getting database metadata
java.sql.SQLException: Network error IOException: Connection refused: connect
Network error IOException: Connection refused: connect
java.sql.SQLException: Network error IOException: Connection refused: connect
Network error IOException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
Connection refused: connect
Thanks for help!
感谢帮助!
1 个解决方案
#1
0
Are you sure that tcp/ip connections is allowed in your server configuration? If yes, check that you are using correct port number for connection. Or if you want to connect throught named pipe, set namedPipe=true; property in the url string.
您确定服务器配置中允许tcp / ip连接吗?如果是,请检查您是否使用正确的端口号进行连接。或者,如果要通过命名管道连接,请设置namedPipe = true; url字符串中的属性。
#1
0
Are you sure that tcp/ip connections is allowed in your server configuration? If yes, check that you are using correct port number for connection. Or if you want to connect throught named pipe, set namedPipe=true; property in the url string.
您确定服务器配置中允许tcp / ip连接吗?如果是,请检查您是否使用正确的端口号进行连接。或者,如果要通过命名管道连接,请设置namedPipe = true; url字符串中的属性。