Wednesday, June 13, 2018

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection hostname

You got the following error when you run your program

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        ...
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
        at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:445)
        at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:464)
        at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:594)
        at oracle.net.ns.NSProtocol.connect(NSProtocol.java:229)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1360)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
        ... 9 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:162)
        at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
        at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:411)
        ... 14 more


Check the followings are correct:

1. the database URL
2. the database port
3. username and password are correct and granted the privilege for the operation
4. the host name is correct in the listener.ora and tnsnames.ora files. They are located at $ORACLE_HOME/netowrk/admin.
5. Check if the listener is running using the command: lsnrctl START

-----------------------------------------------------------------------------------------------------------------

                        


If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here. 

No comments:

Post a Comment