Oracle9i JDBC – Connection refused

I call a Java program in Nagios to test if my database is responding. It is required to test the JDBC connection. The Java program accepts four command line arguments: user, password, hostname, and database.

JdbcThinCheckup mike mike niku

Added a new service to Nagios to check a database and was getting the error below.

Error: Io exception: Connection refused (DESCRIPTION=(TMP=)(VSNNUM=153094144)(ERR=12505)

Turns out I was using the alias “nikuprod” found in the tnsnames.ora file rather than the database name “niku”. JDBC doesn’t utilize the tnsnames.ora file. Not sure why that didn’t occur to me yesterday. Brain fart maybe?


Wasted some time trying to resolve this error by not paying attention. At least I’ll be able to refer back to my blog entry when this happens again a year from now.


11 Responses to Oracle9i JDBC – Connection refused

  1. masurie lim says:

    this is whats on my tnsnames.ora:

    (ADDRESS = (PROTOCOL = TCP)(HOST = oracleprod01)(PORT = 1521))

    and this is whats on my properties file:

    and i still got the error you got:

    Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153094144)(

    would you mind telling me whats wrong with the setup

    thank you

  2. mrothouse says:

    What is the value of the db_name parameter in your database?

    select value from v$parameter where name=’db_name’;

    Try using that value instead of ‘’. Please let me know if that corrects your problem.

    • dchu says:

      [select value from v$parameter where name=’db_name’;]

      This worked for me. Connecting with the TNS name failed. The TNS name and the db_name turned out to be different. Connecting with the db_name was successful.

  3. Bernhard Kern says:

    i tried the following value and now it works

    select value from v$parameter where name = ‘instance_name’

  4. Dayane says:

    Error en la conexion con la BDD ORACLE: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153094144)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
    I have a aplication with Apache Tomcat, jsp , servlet and Jdk 1.5update 13 mys tns is like :



    (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))

    (LOAD_BALANCE = yes)






    my conection from my aplication java to oracle 9i is
    conO = DriverManager.getConnection(“jdbc:oracle:thin:CO_ALCADSL/CA16012009@”);// URL
    anybody knows what´s wrong with the conection
    the oracle is 9i the jdk is 1.5update 13 and the driver jdbc to oracle9i is classes12.jar
    please your help

  5. Dayane says:

    I get it !! Maybe you can check with this because the conection with oracle would be is different
    “jdbc:oracle:thin:@ (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = nodo_1)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = nodo_2)(PORT =1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = miservicio) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5))))”, “username”, “password”

  6. FLC says:


    I’m trying to monitor a JDBC connection with any Nagios plugin… I’ve been searching the JdbcThinCheckup program but I can’t find it. Can you tell me where did you get it?


  7. mrothouse says:

    I do not currently have the need to monitor Oracle JDBC connections and it’s been almost 4 years since I initially implemented this in my environment. I originally downloaded the plugin from Nagios Exchange. However, there appears to be an updated plugin here:

  8. FLC says:


    Thanks for the quick response!
    Ok, the problem was that I googled for JdbcThinCheckup. In Nagios Exchange I didn’t found that one, so I though it was a custom script, instead of a nagios plugin.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: