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 xxx.xx.xx.xxx 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)
(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

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?

NIKUPROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL=TCP)(HOST=myhost)(PORT=1521))
)
(CONNECT_DATA =
(SERVICE_NAME = NIKU)
)
)

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.

Advertisements

11 Responses to Oracle9i JDBC – Connection refused

  1. masurie lim says:

    this is whats on my tnsnames.ora:

    NEW1.METATEC.COM =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracleprod01)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = new1.inoveris.com)
    )
    )

    and this is whats on my properties file:

    project.db.url=jdbc:oracle:thin:@oracleprod01:1521:new1.inoveris.com

    and i still got the error you got:

    Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153094144)(
    ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

    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 ‘new1.inoveris.com’. 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 :
    ANDINA.ANDINATEL.INT =

    (DESCRIPTION =

    (ADDRESS_LIST =

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

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

    (LOAD_BALANCE = yes)

    )

    (CONNECT_DATA =

    (SERVICE_NAME = ANDINA)

    (FAILOVER_MODE = (TYPE=SELECT)(METHOD=BASIC))

    )

    my conection from my aplication java to oracle 9i is
    conO = DriverManager.getConnection(“jdbc:oracle:thin:CO_ALCADSL/CA16012009@172.17.222.71:1521:ANDINA1”);// 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
    co

  5. Dayane says:

    I get it !! Maybe you can check with this because the conection with oracle would be RAC.it 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:

    Hello,

    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?

    Thanks!

  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:

    http://exchange.nagios.org/directory/Plugins/Databases/Oracle/check_db/details

  8. FLC says:

    Hi,

    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.

    Thanks!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: