/ The network adapter could not establish the connection - Problem patterns ~ Java EE Support Patterns

8.15.2011

The network adapter could not establish the connection - Problem patterns

The article will provide you with the common problem patterns responsible to throw the Oracle JDBC Driver error: The network adapter could not establish the connection.
You can also visit another post on this subject describing a real life Case Study on this problem.

The network adapter could not establish the connection – what is it?

This error message is actually the result of an Oracle JDBC driver NT error 20 or 99 (NT connection failed).

The Oracle JDBC driver has a built-in table of its entire internal error message. This can be found under the jar file (ojdbc14.jar / ojdbc6.jar) structure >> oracle/net/mesg/Message.properties

The Network Adapter could not establish the connection is an actual translation of an NT error code 20 or 99 which means the JDBC driver was unable to physically connect to your remote Oracle database.


What are the most common patterns of this problem?

There are a few common scenarios which can lead to this JDBC driver from the most trivial to the harderst problem. Find below of list of the most common patterns. Please review and determine which one is applicable for your current problem scenario:

# Problem pattern #1

A wrong configuration of your Java EE server JDBC Data Source (connection pool) configuration or stand alone JDBC Connection URL values and / or format:

-  A wrong hostname or IP of your Oracle database listener
-  A wrong port of your Oracle database listener
-  A wrong client server host file pointing to a wrong destination / IP address

Ex: Weblogic 11g JDBC DataSource Connection Pool settings for Oracle thin JDBC Driver


Ex: Simple JDBC Connection creation code using the DriverManager

# Problem isolation & reproduction

Have a look at your JDBC Data Source or JDBC Connection and perform a connectivity testing using telnet against your configured Oracle hostname and port settings:

telnet <Oracle listener hostname> <Oracle listener port>

If successfully reproduced, the telnet should either return you unknown host, connection refused or should hang for a long period of time.

# Solution

-     Update your JDBC Data Source or JDBC Connection settings as per proper values in your environment. You should ask your DBA team for proper database access detail

# Problem pattern #2

The network adapter could not establish the connection error is suddenly thrown at runtime with major impact to your application and in a consistent manner (not intermittent). This problem is also quite common and has a few different flavours.

Possible causes:

·         The Oracle database listener encountered an expected problem and terminated  (Oracle listener port is closed)
·         Your remote Oracle database server is no longer physically reachable (network or hardware failure like a NIC card etc.)
·         Your server hosting your client application can no longer each your remote Oracle database server (network problem or hardware failure like a NIC card etc.)


# Problem isolation & reproduction

Depending of where your problem is isolated e.g. client or server side. Use telnet to replicate the problem as per below.

telnet <Oracle listener hostname> <Oracle listener port>

If successfully reproduced, the telnet should either return you unknown host, connection refused or should hang for a long period of time.

You can also use the traceroute command to assess the health from a network perspective through the different HOPS between your client server and remote Oracle DB server.

traceroute <Oracle listener hostname>

Finally, you should also request your DBA team to use the Oracle TNSPING utility to validate the health of your remote Oracle database listener.

# Solution

·         If problem is related to a failed Oracle database listener, ask your DBA team to restart the Oracle listener and secure logs / Oracle errors for future root cause analysis
·         If problem is network related then you will need to isolate first on why side e.g. client or server then deep dive further with your system admin and / or network team until resolution (router, switch problem, NIC card etc.)


# Problem pattern #3

The network adapter could not establish the connection error is thrown at runtime with in an intermittent manner. This problem is less common but you could face a few occurrences from time to time.

I suggest your review another post this Blog for a complete case study on the pattern #3.

Possible causes:

·         The network latency between your client and remote Oracle DB server has increased and causing intermittent connection timeout
·         Packet losses are observed between your client and remote DB server which can lead to intermittent The network adapter could not establish the connection errors
·         Your client or remote physical server could having a problem with one of its NIC card or internal routing table leading to intermittent The network adapter could not establish the connection errors


# Problem isolation & reproduction

Use telnet and traceroute and attempt to replicate the problem as much as you can.

telnet <Oracle listener hostname> <Oracle listener port>
traceroute <Oracle listener hostname>


Setup a ping monitoring script between your client server and remote DB server in order to identify if your are facing packet loss related problem.

# Send 5 packets of 64 bytes to the remote database IP address
ping -c 5 -q -s 64 <IP address>

# Solution

·         You should engage both your system admin and network team in order to investigate further. The system admin should perform basic system check, review OS error logs etc. Your network team should focus on the problem replicate between your source (client) & destination (DB server) and isolate the problem further
·         Again, the resolution can include fixing a problem with server hardware and / or network hardware such as a router or a switch

Final words

I hope this article has helped you understand the common causes of this Oracle JDBC Driver error.
Please feel free to add a comment or question if you are still struggling to identify the root cause of your The network adapter could not establish problem.

3 comments:

Thanks for sharing this information.

HI Guys,
When you are creating user in sqldeveloper for ORACL10g, Before,while installing time, in the end of step you can get password management window, there you don't select the SCOTT user. Don't select the any user in the password management window Jest press Ok. Here in installation i have not give any name for global name. By default ORCL is there. If you change then you need to give that name for service name, Then create user in SQL DEVELOPER tool.

Post a Comment