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 !!