Java. SQL. sqlexception: Io exception: the network adapter cocould not establish the connection Solution

Source: Internet
Author: User

Java. SQL. sqlexception: Io exception: the network adapter cocould not establish the connection is a problem I encountered today.

This is due to many reasons, and there are answers online. My main problem is that the line in hibernate. properties is not included in the hibernate. properties file:

Hibernate. Connection. url JDBC: oracle: thin: @ localhost: 1521: Oracle
Replace the last Oracle with my oracle_sid and change it to orcl. There are still some solutions. I will list them one by one:
1. Shut down Kaspersky firewall.
2. Oracle/ora92/Network/admin/listener. ora and Oracle/ora92/Network/admin/tnsnames. ora.
The two files are as follows:
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)
)
)

Instanchttp =
(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)
)
)

For example, the host in listener. ora is incorrect. Portable is not required for different versions.


Thank you very much !!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.