簡體   English   中英

Hibernate和SQL Server 2005之間的連接異常

[英]Exception in connection between Hibernate and SQL Server 2005

我想將Java項目連接到SQL Server 2005數據庫,但是不幸的是我遇到了一些問題。 我正在使用Windows身份驗證(我的電腦名稱是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>

這是我的例外情況:

 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

感謝幫助!

您確定服務器配置中允許tcp / ip連接嗎? 如果是,請檢查是否使用正確的端口號進行連接。 或者,如果要通過命名管道連接,請設置namedPipe = true;。 url字符串中的屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM