java.sql.SQLException: IO Exception : The Network adapter could not establish the connection?
From our conversation, you are able to telnet & connect to database from command prompt. After going through jdbcurl, I have found the error.
localhost:1521/xe should be localhost:1521:xe if xe is SID for your database.
Change this code from
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521/xe", "scott", "tiger");
To
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe", "scott", "tiger");
Have a look at this article
Java : Io exception: The Network Adapter could not establish the connection
Finally i fixed this issue , this error is caused by the JVM which is using the IPv6 protocol which is not supported by the network/oracle server.
Since i am using Tomcat server for my application i added following argument to tomcat
-Djava.net.preferIPv4Stack=true
or you can add this argument as System environment variable as :
Varable name : _JAVA_OPTIONS
Variable value: -Djava.net.preferIPv4Stack=true
Oracle SQL Developer: Failure - Test failed: The Network Adapter could not establish the connection?
I am answering this for the benefit of future community users. There were multiple issues. If you encounter this problem, I suggest you look for the following:
- Make sure your tnsnames.ora is complete and has the databases you wish to connect to
- Make sure you can tnsping the server you wish to connect to
- On the server, make sure it will be open on the port you desire with the specific application you are using.
Once I did these three things, I solved my problem.
Related Topics
Signal Handling in Asm: Why am I Receiving Sigsegv When Invoking the Sys_Pause Syscall
Posix Shared Memory and Semaphores Permissions Set Incorrectly by Open Calls
Diolan Dln-2 Spi Controller on X86_64 Platform
How to Install Node Binary Distribution Files on Linux
How to Find the Tomcat 7 Installation Folder on Linux Ami in Elastic Beanstalk
Hadoop: «Error:Java_Home Is Not Set»
.Net-Core: Equivalent of Ildasm/Ilasm
How to Imshow with Invisible Figure in Matlab Running on Linux
How to Export Symbol from Linux Kernel Module in This Case
How to File Split at a Line Number
Is There a Limit on Number of Tcp/Ip Connections Between MAChines on Linux
Convert Binary Data to Hexadecimal in a Shell Script