I am working on an internal tool that uses the ORACLE JDBC driver to access the database. In my testing environment, everything is fine, but my colleague got an SQL exception after running the tool.
java.sql.SQLException: Io exception:
The Network Adapter could not establish connection
First, I search the internet and all results roots from
this solution. But it doesn't apply to my case.
So I return to the starting point, and think if the database connection is available to my colleague. He doesn't have ORACLE installed, so there is no
tnsping.exe tool and
tnsnames. But there is telnet, and you can type this command to see if the database instance at the port on the host is available to you
telnet host port
If it is available, you will be led to a clean dos window; otherwise, there will be message saying "
Could not open connection to the host...".
It turns out that our network engineer has put some restrictions on the IPs that are allowed to access the database, and that is the cause for the IO exception.
Read more!