Unable to connect to Oracle database from certain client machines

networkingoracle

I have an application that connects to an Oracle database that works fine in development on any development machine I can find but falls over with the following error when being ran from a production or test server environment:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3668)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:353)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:371)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:551)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:351)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
....

Network configuration is always a little sketchier from test and production environments here compared to development machines so my first assumption was that firewalls haven't been properly configured but I've checked those and just to be sure I tried telnetting from the affected machines to the Oracle servers on the necessary port and that works fine:

[root@CLIENT ~]# telnet [Oracle Host IP] 1521
Trying [Oracle Host IP]...
Connected to [Oracle Host IP].
Escape character is '^]'.
^C

Connection closed by foreign host.

Is there anything else I can be missing here? Or at least any other suggestions for debugging this issue?

I figured if I can ping from the affected machine to the target Oracle server and even telnet on the port then they should be able to communicate but not sure if there's something Oracle specific that I'm missing here.

Best Answer

Not an answer (at least not yet) but I need formatting.

I don't know anything about Talend. Possibly it's displaying the exception/stacktrace in an unusual way. Or another possibility: I did some experimenting and I can get a stacktrace more like yours, in particular without the cause chain, but still not identical, using an older ojdbc14.jar I have lying about from 2006.

To get at least a little light in the darkness I suggest you (store and) compile this minimal standalone app

import java.sql.DriverManager;

public class ConnectOradb {
    public static void main (String [] args) throws Exception {
        String url = "jdbc:oracle:thin:@localhost:1521:orcl";
        // may be unnecessary (but harmless) for newer versions
        Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
        DriverManager.getConnection(url, "user", "pass"); 
    }
}

changing host, port, SID, user, pw as needed, and run it, with the same ojdbc library if there is more than one on your system, and preferably the same JRE although I doubt that matters: /path/to/java -cp .;/path/to/ojdbc?.jar ConnectOradb

If you can't do that, but you can determine the version of the ojdbc and it's old and you can try a newer, that might help.

Related Topic