Strawberry
Strawberry

Reputation: 67888

IO Error: The Network Adapter could not establish the connection

I am new to Oracle, and am trying to run a simple example code with Java, but am getting this error when executing the code.. I am able to start up the listener via CMD and am also able to run SQL Plus. Can anyone give me a hand and tell me what I might be doing wrong?

Update: I am using JDBC.

Database is local, and I actually had it working but it stopped working just today. I'm not really sure why though. Would you mind giving me some procedures to follow by since I don't know much.

Upvotes: 49

Views: 559949

Answers (15)

Md Shahriar
Md Shahriar

Reputation: 2746

Go to Services and start all these enter image description here

Upvotes: 0

user1827044
user1827044

Reputation: 176

Another thing you might want to check that the listener.ora file matches the way you are trying to connect to the DB. If you were connecting via a localhost reference and your listener.ora file got changed from:

HOST = localhost

to

HOST = 192.168.XX.XX

you can also check on tnsnames.ora, check if the host is changed from localhost to 192.168.XX.XXX or in simple ways just use your computer name rather than localhost

then this can cause the error that you had unless you update your hosts file to accommodate for this. Someone might have made this change to allow for remote connections to the DB from other machines.

Upvotes: 3

Michel Souza
Michel Souza

Reputation: 25

In my case this happened in SOA (Oracle Weblogic) because the database tablespace was at its limit and in addition the machine's network adapter in OCI was intermittent, it was only resolved after restoring the machine's boot backup from a week ago and extend the tablespace.

Stack simplified
####<Jun 25, 2024 3:20:58 PM BRT> <Warning> <JDBC> <Unknown> <pip02> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <0000P1GcDzu1f_OLqix0iY1aUkdg000002> <1719339658829> <BEA-001129> <Received exception while creating connection for pool "mds-soa": IO Error: The Network Adapter could not establish the connection> 
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
Caused By: oracle.net.ns.NetException: The Network Adapter could not establish the connection
Caused By: java.net.ConnectException: Connection timed out (Connection timed out)

Upvotes: 0

Serge V.
Serge V.

Reputation: 3623

I resolved my issue by simply starting the TNS listener service. It was stopped for some reason. enter image description here

Upvotes: 6

DANISH ANSARI
DANISH ANSARI

Reputation: 11

IO Error: The Network Adapter could not establish the connection (CONNECTION_ID=iKQM6lBbSLiArrYuDqud8A==)

if you are facing this issue 1- make sure you have downloaded oracle databases like oracle 11g,19c, 21c, or any latest databases. 2- search for services in your computer or type win+r then services.mis then search for oracleservice you will find orcl or xe or any other sid like oracleserviceorcl;

after that you can test your connection using sql developer, sql plus or cmd

Upvotes: 1

Tony Shevchenko
Tony Shevchenko

Reputation: 1

Just try to re-create connection. In my situation one of jdbc connection stopped working for no reason. From console sqlplus was working ok. It took me 2 hours to realize that If i create the same connection - it works.

Upvotes: -2

A May
A May

Reputation: 9

I was having issues with this as well. I was using the jdbc connection string to connect to the database. The hostname was incorrectly configured in the string. I am using Mac, and the same string was being used on Windows machines without an issue. On my connection string, I had to make sure that I had the full url with the appending "organizationname.com" to the end of the hostname.

Hope this helps.

Upvotes: -1

anion
anion

Reputation: 2049

I had this error when i renamed the pc in the windows-properties. The pc-name must be updated in the listener.ora-file

Upvotes: 1

Mamed Shahmaliyev
Mamed Shahmaliyev

Reputation: 333

Most probably you have listener configured wrongly, the hostname you specify in connection string must be the same as in the listener.

First check the Firewall and network related issues.

Check if Oracle Listener service is available and running. If not you may use Oracle Net Configuration Assistant tool to add and register new listener.

If the above steps are ok then you need to configure Oracle Listener appropriately. You may use Oracle Net Manager tool or edit “%ORACLE_HOME%\network\admin\listener.ora” file manually.

There are 2 options that need to be considered carefully: Listening Locations associated with the Listener – Hostname(IP) and Port in Listening Location must exactly match the ones used in the connection string.

For example, if you use 192.168.74.139 as target hostname, then there must be Listening Location registered with the same IP address.

Also make sure the you use the same SID as indicated in Database Service associated with the Listener.

https://adhoctuts.com/fix-oracle-io-error-the-network-adapter-could-not-establish-the-connection-error/

Upvotes: 0

V Gupta
V Gupta

Reputation: 23

I figured out that in my case, my database was in different subnet than the subnet from where i was trying to access the db.

Upvotes: 1

Karisa
Karisa

Reputation: 9

For me the basic oracle only was not installed. Please ensure you have oracle installed and then try checking host and port.

Upvotes: -1

user207421
user207421

Reputation: 310956

Either:

  1. The database isn't running
  2. You got the URL wrong
  3. There is a firewall in the way.

(This strange error message is produced by Oracle's JDBC driver when it can't connect to the database server. 'Network adapter' appears to refer to some component of their code, which isn't very useful. Real network adapters (NICs) don't establish connections at all: TCP protocol stacks do that. It would have been a lot more useful if they had just let the original ConnectException be thrown, or at least used its error message and let it appear in the stack trace.)

Upvotes: 53

Kris Selbekk
Kris Selbekk

Reputation: 7634

In my case, I needed to specify a viahost and viauser. Worth trying if you're in a complex system. :)

Upvotes: -1

Dharm
Dharm

Reputation: 1

To resolve the Network Adapter Error I had to remove the - in the name of the computer name.

Upvotes: -1

shams
shams

Reputation: 101

I had the same problem, and this is how I fixed it. I was using the wrong port for my connection.

private final String DB_URL  = "jdbc:oracle:thin:@localhost:1521:orcll"; // 1521 my wrong port
  • go to your localhost
  • (my localhost address) : https://localhost:1158/em

  • login

    • user name
    • password
    • connect as --> normal
  • Below 'General' click on LISTENER_localhost

  • look at you port number
    • Net Address (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522)) Connect to port 1522
  • Edit you connection change port 1521 to 1522.

    • done

Upvotes: 10

Related Questions