java.sql.SQLException: Io 異常: The Network Adapter could not establish the connection解決方案

來源:互聯網
上載者:User

 java.sql.SQLException: Io 異常: The Network Adapter could not establish the connection是我今天剛遇到的問題,有很

多原因導致這個,網上也有答案,我的主要毛病是在hibernate.properties檔案中沒有把hibernate.properties中的行:

hibernate.connection.url jdbc:oracle:thin:@localhost:1521:oracle
最後一個oracle替換為我的oracle_sid,改成orcl後就沒事,還有一些解決方案。我一一列出:
1、把卡巴斯基防火牆關掉就好了
2、oracle/ora92/network/admin/listener.ora  和 oracle/ora92/network/admin/tnsnames.ora 的設定問題。
兩個檔案如下:
listener.ora:
# LISTENER.ORA Network Configuration File: F:/oracle/ora92/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = lei)(PORT = 1521))
      )
    )
  )
#change 1521 to 1523 this is oracle92's listener
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = F:/oracle/ora92)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = F:/oracle/ora92)
      (SID_NAME = orcl)
    )
  )

tnsnames.ora:
# TNSNAMES.ORA Network Configuration File: F:/oracle/ora92/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = lei)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

INST1_HTTP =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = lei)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = SHARED)
      (SERVICE_NAME = MODOSE)
      (PRESENTATION = http://HRService)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

    比如,listener.ora中的host寫錯了。不同的版本所需要的portable也不會一樣的。

    
  還是非常感謝大家!!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.